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))))
|
||||
|
||||
;;;###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
|
||||
is selected)."
|
||||
(interactive "rP")
|
||||
(if (use-region-p)
|
||||
(+format/region beg end arg)
|
||||
(call-interactively #'+format/buffer)))
|
||||
(interactive)
|
||||
(call-interactively
|
||||
(if (use-region-p)
|
||||
#'+format/region
|
||||
#'+format/buffer)))
|
||||
|
||||
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue