editor/format: don't move cursor on save

This commit is contained in:
Henrik Lissner 2018-08-26 17:26:54 +02:00
parent af045213e3
commit f1460ff592
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 12 additions and 1 deletions

View file

@ -217,3 +217,14 @@ is selected)."
(if (use-region-p)
(+format-region beg end)
(format-all-buffer)))
;;
;; Hooks
;;
;;;###autoload
(defun +format|on-save ()
"Runs `format-all-buffer' without moving the cursor."
(save-excursion
(format-all-buffer)))