editor/format: override format-all-buffer w/ +format/buffer

This commit is contained in:
Henrik Lissner 2018-09-08 23:39:52 -04:00
parent 8480f52081
commit 3c34ff003b
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -43,3 +43,11 @@ This is controlled by `+format-on-save-enabled-modes'."
;; Allow a specific formatter to be used by setting `+format-with', either
;; buffer-locally or let-bound.
(advice-add #'format-all-probe :around #'+format*probe)
;; Doom uses a modded `format-all-buffer', which
;; 1. Doesn't move the cursorafter reformatting,
;; 2. Can reformat regions, rather than the entire buffer (while preserving
;; leading indentation),
;; 3. Applies changes via RCS patch, line by line, as not to protect buffer
;; markers and avoid any jarring cursor+window scrolling.
(advice-add #'format-all-buffer :override #'+format/buffer)