]> code.delx.au - gnu-emacs-elpa/commitdiff
Move fringe bitmap initialization into minor mode def function.
authorJoseph Churchill <joseph@jalan.org>
Fri, 8 Feb 2013 19:20:37 +0000 (11:20 -0800)
committerJoseph Churchill <joseph@jalan.org>
Fri, 8 Feb 2013 19:20:37 +0000 (11:20 -0800)
Also, in turn-on-diff-hl-mode, the all initialization code was inside
(when (window-sytem) ...)
preventing the mode from being enabled at all in a terminal (and not just
the fringe bitmaps from being enabled).

diff-hl.el

index e4e69a4e7e9cfaf36e9de300eae92f431e7972ce..609c6e8ee63784ad40b46bfb62efa786287d1851 100644 (file)
@@ -328,6 +328,10 @@ in the source file, or the last line of the hunk above it."
                         (,(kbd "C-x v ]") . diff-hl-next-hunk))\r
   (if diff-hl-mode\r
       (progn\r
+        (when (window-system) ;; No fringes in the console.\r
+          (unless (fringe-bitmap-p 'diff-hl-bmp-empty)\r
+            (diff-hl-define-bitmaps)\r
+            (define-fringe-bitmap 'diff-hl-bmp-empty [0] 1 1 'center)))\r
         (add-hook 'after-save-hook 'diff-hl-update nil t)\r
         (add-hook 'after-change-functions 'diff-hl-edit nil t)\r
         (if vc-mode\r
@@ -377,15 +381,11 @@ in the source file, or the last line of the hunk above it."
 ;;;###autoload\r
 (defun turn-on-diff-hl-mode ()\r
   "Turn on `diff-hl-mode' or `diff-hl-dir-mode' in a buffer if appropriate."\r
-  (when (window-system) ;; No fringes in the console.\r
-    (unless (fringe-bitmap-p 'diff-hl-bmp-empty)\r
-      (diff-hl-define-bitmaps)\r
-      (define-fringe-bitmap 'diff-hl-bmp-empty [0] 1 1 'center))\r
-    (cond\r
-     (buffer-file-name\r
-      (diff-hl-mode 1))\r
-     ((eq major-mode 'vc-dir-mode)\r
-      (diff-hl-dir-mode 1)))))\r
+  (cond\r
+   (buffer-file-name\r
+    (diff-hl-mode 1))\r
+   ((eq major-mode 'vc-dir-mode)\r
+    (diff-hl-dir-mode 1))))\r
 \r
 ;;;###autoload\r
 (define-globalized-minor-mode global-diff-hl-mode diff-hl-mode\r