]> code.delx.au - gnu-emacs-elpa/commitdiff
Remove diff-hl-flydiff/update-modified-tick advice
authorDmitry Gutov <dgutov@yandex.ru>
Wed, 6 Jan 2016 19:01:44 +0000 (22:01 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Wed, 6 Jan 2016 19:01:44 +0000 (22:01 +0300)
It was broken:

* There's no function called diff-hl-change.

* Calling it from after-change-functions meant the tick value seemed
  always up to date.

diff-hl-flydiff.el

index a63bc06e458997e215bea9f5fb79c734d7efc076..e5a6111f45d66fd49653719da2deccf389f7b774 100644 (file)
@@ -124,6 +124,7 @@ the user should be returned."
 This requires the external program `diff' to be in your `exec-path'."
   (interactive)
   (vc-ensure-vc-buffer)
+  (setq diff-hl-flydiff-modified-tick (buffer-modified-tick))
   (with-current-buffer (get-buffer (current-buffer))
     (let* ((temporary-file-directory
             (if (file-directory-p "/dev/shm/")
@@ -139,16 +140,12 @@ This requires the external program `diff' to be in your `exec-path'."
   (unless (and auto
                (or
                 (= diff-hl-flydiff-modified-tick (buffer-modified-tick))
-                (file-remote-p default-directory)
-                (not (buffer-modified-p))))
+                (file-remote-p default-directory)))
     (funcall old-fun)))
 
 (defun diff-hl-flydiff/modified-p (state)
   (buffer-modified-p))
 
-(defun diff-hl-flydiff/update-modified-tick (&rest args)
-  (setq diff-hl-flydiff-modified-tick (buffer-modified-tick)))
-
 ;;;###autoload
 (define-minor-mode diff-hl-flydiff-mode
   "Highlight diffs on-the-fly"
@@ -163,9 +160,6 @@ This requires the external program `diff' to be in your `exec-path'."
                     #'diff-hl-flydiff/modified-p)
         (advice-add 'diff-hl-changes-buffer :override
                     #'diff-hl-flydiff-buffer-with-head)
-        (advice-add 'diff-hl-change :after
-                    #'diff-hl-flydiff/update-modified-tick)
-
         (setq diff-hl-flydiff-timer
               (run-with-idle-timer diff-hl-flydiff-delay t #'diff-hl-update t)))
 
@@ -174,7 +168,6 @@ This requires the external program `diff' to be in your `exec-path'."
 
     (advice-remove 'diff-hl-modified-p #'diff-hl-flydiff/modified-p)
     (advice-remove 'diff-hl-changes-buffer #'diff-hl-flydiff-buffer-with-head)
-    (advice-remove 'diff-hl-change #'diff-hl-flydiff/update-modified-tick)
 
     (cancel-timer diff-hl-flydiff-timer)))