mirror of
https://github.com/vale981/apheleia
synced 2025-03-05 09:31:40 -05:00
[#8] Make sure to reformat correct buffer
This commit is contained in:
parent
8e99a67cc1
commit
2d6d3945a2
1 changed files with 16 additions and 13 deletions
|
@ -591,19 +591,22 @@ changes), CALLBACK, if provided, is invoked with no arguments."
|
|||
;; error on `post-command-hook'.
|
||||
(unless (apheleia--disallowed-p)
|
||||
(setq-local apheleia--buffer-hash (apheleia--buffer-hash))
|
||||
(let ((cur-buffer (current-buffer)))
|
||||
(apheleia--run-formatter
|
||||
command
|
||||
(lambda (formatted-buffer)
|
||||
(with-current-buffer cur-buffer
|
||||
;; Short-circuit.
|
||||
(when (equal apheleia--buffer-hash (apheleia--buffer-hash))
|
||||
(apheleia--create-rcs-patch
|
||||
(current-buffer) formatted-buffer
|
||||
(lambda (patch-buffer)
|
||||
(with-current-buffer cur-buffer
|
||||
(when (equal apheleia--buffer-hash (apheleia--buffer-hash))
|
||||
(apheleia--apply-rcs-patch
|
||||
(current-buffer) patch-buffer)
|
||||
(when callback
|
||||
(funcall callback))))))))))
|
||||
(funcall callback)))))))))))))
|
||||
|
||||
(defcustom apheleia-post-format-hook nil
|
||||
"Normal hook run after Apheleia formats a buffer."
|
||||
|
|
Loading…
Add table
Reference in a new issue