Skip to content

Commit 2f1623d

Browse files
committed
diff-hl-margin-local-mode: Check that the margin is 0 first
Fixes #289
1 parent 759e7f1 commit 2f1623d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

diff-hl-margin.el

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,15 @@ You probably shouldn't use this function directly."
132132
#'diff-hl-highlight-on-margin)
133133
(setq-local diff-hl-highlight-reference-function
134134
#'diff-hl-highlight-on-margin-flat)
135-
(setq-local diff-hl-margin-old-width (symbol-value width-var))
136-
(set width-var 1))
135+
(when (zerop (symbol-value width-var))
136+
(setq-local diff-hl-margin-old-width (symbol-value width-var))
137+
(set width-var 1)))
137138
(when diff-hl-margin-old-highlight-function
138139
(setq diff-hl-highlight-function diff-hl-margin-old-highlight-function
139140
diff-hl-highlight-reference-function diff-hl-margin-old-highlight-ref-function
140141
diff-hl-margin-old-highlight-function nil))
141-
(set width-var diff-hl-margin-old-width)
142+
(when diff-hl-margin-old-width
143+
(set width-var diff-hl-margin-old-width))
142144
(kill-local-variable 'diff-hl-margin-old-width)))
143145
(dolist (win (get-buffer-window-list))
144146
(set-window-buffer win (current-buffer))))

0 commit comments

Comments
 (0)