emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/diff-hl 328e23e 23/25: Introduce diff-hl-after-revert


From: Dmitry Gutov
Subject: [elpa] externals/diff-hl 328e23e 23/25: Introduce diff-hl-after-revert
Date: Sun, 20 Dec 2020 05:07:05 -0500 (EST)

branch: externals/diff-hl
commit 328e23e73edf69cf8cff420ad4ccb15b827e2b7a
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]