]> code.delx.au - gnu-emacs-elpa/commitdiff
Support the "next" Magit version
authorDmitry Gutov <dgutov@yandex.ru>
Sat, 4 Apr 2015 16:01:13 +0000 (19:01 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Sat, 4 Apr 2015 16:02:19 +0000 (19:02 +0300)
Closes #41

README.md
diff-hl.el

index 325f53ea570c349cbb6f346eafedf7f4106ef82c..0f9fe6481ab4b0a6f1830fa6284846c4786fc97a 100644 (file)
--- a/README.md
+++ b/README.md
@@ -87,4 +87,4 @@ Magit
 -----\r
 \r
 If you have a recent enough version installed, it defines\r
-`magit-revert-buffer-hook`, which we use.\r
+`magit-revert-buffer-hook` (or `magit-not-reverted-hook`), which we use.\r
index 22a877a641353ac42af10828e1801ecd65e3bb93..a3e5447f6b78e869ff0189df5280ededd80eb0cc 100644 (file)
@@ -453,6 +453,9 @@ in the source file, or the last line of the hunk above it."
         ;; doesn't care about changed VC state.\r
         ;; https://github.com/magit/magit/issues/603\r
         (add-hook 'magit-revert-buffer-hook 'diff-hl-update nil t)\r
+        ;; Magit 2+ doesn't do the above and calls this instead,\r
+        ;; but only when it doesn't call `revert-buffer':\r
+        (add-hook 'magit-not-reverted-hook 'diff-hl-update nil t)\r
         (add-hook 'auto-revert-mode-hook 'diff-hl-update nil t)\r
         (add-hook 'text-scale-mode-hook 'diff-hl-define-bitmaps nil t))\r
     (remove-hook 'after-save-hook 'diff-hl-update t)\r
@@ -461,6 +464,7 @@ in the source file, or the last line of the hunk above it."
     (remove-hook 'vc-checkin-hook 'diff-hl-update t)\r
     (remove-hook 'after-revert-hook 'diff-hl-update t)\r
     (remove-hook 'magit-revert-buffer-hook 'diff-hl-update t)\r
+    (remove-hook 'magit-not-reverted-hook 'diff-hl-update t)\r
     (remove-hook 'auto-revert-mode-hook 'diff-hl-update t)\r
     (remove-hook 'text-scale-mode-hook 'diff-hl-define-bitmaps t)\r
     (diff-hl-remove-overlays)))\r