]> code.delx.au - gnu-emacs-elpa/blobdiff - diff-hl.el
Merge pull request #39 from jamessan/diff-hl-margin-load-error
[gnu-emacs-elpa] / diff-hl.el
index 2488f4d1b77d260c2a3a990e9421013d4f09b4ef..22a877a641353ac42af10828e1801ecd65e3bb93 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author:   Dmitry Gutov <dgutov@yandex.ru>\r
 ;; URL:      https://github.com/dgutov/diff-hl\r
 ;; Keywords: vc, diff\r
-;; Version:  1.6.0\r
+;; Version:  1.7.0\r
 ;; Package-Requires: ((cl-lib "0.2"))\r
 \r
 ;; This file is part of GNU Emacs.\r
     (define-fringe-bitmap 'diff-hl-bmp-middle middle h w 'center)\r
     (define-fringe-bitmap 'diff-hl-bmp-bottom bottom h w 'bottom)\r
     (define-fringe-bitmap 'diff-hl-bmp-single single h w 'top)\r
+    (define-fringe-bitmap 'diff-hl-bmp-i [3 3 0 3 3 3 3 3 3 3] nil 2 'center)\r
     (let* ((w2 (* (/ w 2) 2))\r
+           ;; When fringes are disabled, it's easier to fix up the width,\r
+           ;; instead of doing nothing (#20).\r
+           (w2 (if (zerop w2) 2 w2))\r
            (delete-row (- (expt 2 (1- w2)) 2))\r
            (middle-pos (1- (/ w2 2)))\r
            (middle-bit (expt 2 middle-pos))\r
   (cl-case type\r
     (unknown 'question-mark)\r
     (change 'exclamation-mark)\r
-    (ignored 'filled-square)\r
+    (ignored 'diff-hl-bmp-i)\r
     (t (intern (format "diff-hl-bmp-%s" type)))))\r
 \r
 (defvar vc-svn-diff-switches)\r
             (with-current-buffer buf-name\r
               (goto-char (point-min))\r
               (unless (eobp)\r
-                (diff-beginning-of-hunk t)\r
+                (ignore-errors\r
+                  (diff-beginning-of-hunk t))\r
                 (while (looking-at diff-hunk-header-re-unified)\r
                   (let ((line (string-to-number (match-string 3)))\r
                         (len (let ((m (match-string 4)))\r
@@ -448,6 +453,7 @@ 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
+        (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
     (remove-hook 'after-change-functions 'diff-hl-edit t)\r
@@ -455,6 +461,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 '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
 \r