mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-29 14:33:34 -05:00
fix(format): prefix arg inhibiting format-on-save (part 2)
Experimenting with a new approach to this issue, in an effort to avoid
advice on such low level commands ({basic-,}save-buffer). I don't like
that we're still stacking new behavior on top of their pre-existing
prefix arg behavior (manipulating backup-on-save functionality), but
maybe it's not useful enough to worry about?
Fix: #8420
Amend: f0c8290ae2
This commit is contained in:
@@ -45,11 +45,10 @@ This is controlled by `+format-on-save-disabled-modes'."
|
||||
(set-debug-variable! 'apheleia-log-only-errors nil)
|
||||
(set-debug-variable! 'apheleia-log-debug-info t 2)
|
||||
|
||||
(defadvice! +format--inhibit-reformat-on-prefix-arg-a (orig-fn &optional arg)
|
||||
"Make it so \\[save-buffer] with prefix arg inhibits reformatting."
|
||||
:around #'basic-save-buffer
|
||||
(let ((apheleia-inhibit (or apheleia-inhibit current-prefix-arg)))
|
||||
(funcall orig-fn)))
|
||||
;; UX: Use prefix-arg on `save-buffer' or `basic-save-buffer' to inhibit
|
||||
;; format-on-save behavior.
|
||||
(define-key apheleia-mode-map [remap basic-save-buffer] #'+format/save-buffer-no-reformat)
|
||||
(define-key apheleia-mode-map [remap save-buffer] #'+format/save-buffer)
|
||||
|
||||
;; HACK: Apheleia suppresses notifications that the current buffer has
|
||||
;; changed, so plugins that listen for them need to be manually informed:
|
||||
|
Reference in New Issue
Block a user