emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 76289d2 4/8: Add and use diff-hl-maybe-redefine-bitmaps


From: Dmitry Gutov
Subject: [elpa] master 76289d2 4/8: Add and use diff-hl-maybe-redefine-bitmaps
Date: Sat, 23 Feb 2019 18:35:44 -0500 (EST)

branch: master
commit 76289d24c61fac501d955a8419b5fdf7debddd5f
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Add and use diff-hl-maybe-redefine-bitmaps
    
    Fixes #121
---
 diff-hl.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/diff-hl.el b/diff-hl.el
index 5ef4f88..5333789 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -187,6 +187,10 @@ the end position as its only argument."
       (diff-hl-define-bitmaps)
       (define-fringe-bitmap 'diff-hl-bmp-empty [0] 1 1 'center))))
 
+(defun diff-hl-maybe-redefine-bitmaps ()
+  (when (window-system)
+    (diff-hl-define-bitmaps)))
+
 (defvar diff-hl-spec-cache (make-hash-table :test 'equal))
 
 (defun diff-hl-fringe-spec (type pos side)
@@ -534,7 +538,7 @@ The value of this variable is a mode line template as in
         ;; instead, but only when they dosn't call `revert-buffer':
         (add-hook 'magit-not-reverted-hook 'diff-hl-update nil t)
         (add-hook 'auto-revert-mode-hook 'diff-hl-update nil t)
-        (add-hook 'text-scale-mode-hook 'diff-hl-define-bitmaps nil t))
+        (add-hook 'text-scale-mode-hook 'diff-hl-maybe-redefine-bitmaps nil t))
     (remove-hook 'after-save-hook 'diff-hl-update t)
     (remove-hook 'after-change-functions 'diff-hl-edit t)
     (remove-hook 'find-file-hook 'diff-hl-update t)
@@ -543,7 +547,7 @@ The value of this variable is a mode line template as in
     (remove-hook 'magit-revert-buffer-hook 'diff-hl-update t)
     (remove-hook 'magit-not-reverted-hook 'diff-hl-update t)
     (remove-hook 'auto-revert-mode-hook 'diff-hl-update t)
-    (remove-hook 'text-scale-mode-hook 'diff-hl-define-bitmaps t)
+    (remove-hook 'text-scale-mode-hook 'diff-hl-maybe-redefine-bitmaps t)
     (diff-hl-remove-overlays)))
 
 (when (require 'smartrep nil t)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]