branch: externals/diff-hl commit 328e23e73edf69cf8cff420ad4ccb15b827e2b7a Author: Dmitry Gutov <dgu...@yandex.ru> Commit: Dmitry Gutov <dgu...@yandex.ru>
Introduce diff-hl-after-revert To only update when necessary (e.g. auto-revert-mode did its thing). #152 --- diff-hl.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/diff-hl.el b/diff-hl.el index 2c543e7..98c16b8 100644 --- a/diff-hl.el +++ b/diff-hl.el @@ -405,6 +405,11 @@ performance when viewing such files in certain conditions." (unless (buffer-modified-p) (diff-hl-update)))) +(defun diff-hl-after-revert () + (defvar revert-buffer-preserve-modes) + (when revert-buffer-preserve-modes + (diff-hl-update))) + (defun diff-hl-diff-goto-hunk-1 () (vc-buffer-sync) (let* ((line (line-number-at-pos)) @@ -582,7 +587,7 @@ The value of this variable is a mode line template as in 'find-file-hook) 'diff-hl-update-once t t) (add-hook 'vc-checkin-hook 'diff-hl-update nil t) - (add-hook 'after-revert-hook 'diff-hl-update nil t) + (add-hook 'after-revert-hook 'diff-hl-after-revert nil t) ;; Magit does call `auto-revert-handler', but it usually ;; doesn't do much, because `buffer-stale--default-function' ;; doesn't care about changed VC state.