tweak(format): +format/region: emit message on success

This commit is contained in:
Henrik Lissner 2024-08-20 16:36:22 -04:00
parent 67e5dda526
commit abf19aa63e
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -68,14 +68,21 @@
(defalias '+format/buffer #'apheleia-format-buffer) (defalias '+format/buffer #'apheleia-format-buffer)
;;;###autoload ;;;###autoload
(defun +format/region (beg end &optional _arg) (defun +format/region (beg end &optional _arg interactive)
"Format the selected region. "Format the selected region.
WARNING: if the formatter doesn't support partial formatting, this command tries WARNING: if the formatter doesn't support partial formatting, this command tries
to pretend the active selection is the contents of a standalone file, but this to pretend the active selection is the contents of a standalone file, but this
may not always work. Keep your undo keybind handy!" may not always work. Keep your undo keybind handy!"
(interactive "rP") (interactive (list (doom-region-beginning)
(+format-region beg end)) (doom-region-end)
current-prefix-arg
'interactive))
(+format-region
beg end
(lambda ()
(when interactive
(message "Region reformatted!")))))
;;;###autoload ;;;###autoload
(defun +format/region-or-buffer () (defun +format/region-or-buffer ()