From da9348b38618e5122c3c3fda3b711330c1cb9dd2 Mon Sep 17 00:00:00 2001 From: Joseph Churchill Date: Fri, 8 Feb 2013 11:20:37 -0800 Subject: [PATCH] Move fringe bitmap initialization into minor mode def function. 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 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/diff-hl.el b/diff-hl.el index e4e69a4e7..609c6e8ee 100644 --- a/diff-hl.el +++ b/diff-hl.el @@ -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)) (if diff-hl-mode (progn + (when (window-system) ;; No fringes in the console. + (unless (fringe-bitmap-p 'diff-hl-bmp-empty) + (diff-hl-define-bitmaps) + (define-fringe-bitmap 'diff-hl-bmp-empty [0] 1 1 'center))) (add-hook 'after-save-hook 'diff-hl-update nil t) (add-hook 'after-change-functions 'diff-hl-edit nil t) (if vc-mode @@ -377,15 +381,11 @@ in the source file, or the last line of the hunk above it." ;;;###autoload (defun turn-on-diff-hl-mode () "Turn on `diff-hl-mode' or `diff-hl-dir-mode' in a buffer if appropriate." - (when (window-system) ;; No fringes in the console. - (unless (fringe-bitmap-p 'diff-hl-bmp-empty) - (diff-hl-define-bitmaps) - (define-fringe-bitmap 'diff-hl-bmp-empty [0] 1 1 'center)) - (cond - (buffer-file-name - (diff-hl-mode 1)) - ((eq major-mode 'vc-dir-mode) - (diff-hl-dir-mode 1))))) + (cond + (buffer-file-name + (diff-hl-mode 1)) + ((eq major-mode 'vc-dir-mode) + (diff-hl-dir-mode 1)))) ;;;###autoload (define-globalized-minor-mode global-diff-hl-mode diff-hl-mode -- 2.39.2