]> code.delx.au - gnu-emacs-elpa/commitdiff
* diff-hl-add-highlighting: Return the overlay
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 8 Sep 2013 04:39:05 +0000 (07:39 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 8 Sep 2013 04:39:24 +0000 (07:39 +0300)
* diff-hl-dired-highlight-items: Make sure the overlay will disappear
  if the file is deleted.

diff-hl-dired.el
diff-hl.el

index 66991026d559fe9d3795c03e3b59cfc7c4e51cc4..a3b766fbebc11357b0ae721890ebedc0a4d4f8f3 100644 (file)
         (goto-char (point-min))
         (when (and type (dired-goto-file-1
                          file (expand-file-name file) nil))
-          (forward-line 0)
-          (let ((diff-hl-fringe-bmp-function 'diff-hl-fringe-bmp-from-type))
-            (diff-hl-add-highlighting type 'single)))))))
+          (let* ((diff-hl-fringe-bmp-function 'diff-hl-fringe-bmp-from-type)
+                 (o (diff-hl-add-highlighting type 'single)))
+            (overlay-put o 'modification-hooks '(diff-hl-overlay-modified))
+            ))))))
 
 (defalias 'diff-hl-dired-clear 'diff-hl-remove-overlays)
 
index 87f15bf635e22aa98117765ed8fb9efc48041dac..583fd148d28e9a46a4075f5b56053e95abed4ba3 100644 (file)
 (defun diff-hl-add-highlighting (type shape)\r
   (let ((o (make-overlay (point) (point))))\r
     (overlay-put o 'diff-hl t)\r
-    (overlay-put o 'before-string (diff-hl-fringe-spec type shape))))\r
+    (overlay-put o 'before-string (diff-hl-fringe-spec type shape))\r
+    o))\r
 \r
 (defun diff-hl-remove-overlays ()\r
   (dolist (o (overlays-in (point-min) (point-max)))\r