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:
Henrik Lissner
2019-04-02 00:51:29 -04:00
parent 3eaa57c747
commit 5c3188afd5

View File

@ -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)))
;; ;;