editor/format: fix +format/region-or-buffer
The `r` interactive spec barfs an error if no mark is active, preventing this function from ever calling `+format/buffer`. Reported by @amosbird
This commit is contained in:
parent
3eaa57c747
commit
5c3188afd5
1 changed files with 6 additions and 5 deletions
|
@ -204,13 +204,14 @@ snippets or single lines."
|
||||||
(+format/buffer arg))))
|
(+format/buffer arg))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +format/region-or-buffer (beg end &optional arg)
|
(defun +format/region-or-buffer ()
|
||||||
"Runs the active formatter on the selected region (or whole buffer, if nothing
|
"Runs the active formatter on the selected region (or whole buffer, if nothing
|
||||||
is selected)."
|
is selected)."
|
||||||
(interactive "rP")
|
(interactive)
|
||||||
|
(call-interactively
|
||||||
(if (use-region-p)
|
(if (use-region-p)
|
||||||
(+format/region beg end arg)
|
#'+format/region
|
||||||
(call-interactively #'+format/buffer)))
|
#'+format/buffer)))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue