diff --git a/modules/editor/format/config.el b/modules/editor/format/config.el index 1ad72e590..47002c9e3 100644 --- a/modules/editor/format/config.el +++ b/modules/editor/format/config.el @@ -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)