fix bug mode-line not reset after multiple invocations

Fix a bug where the mode-line would not get rid of or regain the winum segment
after winum-mode being activated several times non-interactively and then
deactivated.
This commit is contained in:
Thomas de Beauchêne 2018-11-07 01:44:48 +01:00
parent 6f0c451799
commit a096da2881

View file

@ -418,7 +418,9 @@ POSITION: position in the mode-line."
(push winum--mode-line-segment res)) (push winum--mode-line-segment res))
(while mode-line (while mode-line
(push (pop mode-line) res)) (push (pop mode-line) res))
(setq-default mode-line-format (nreverse res))) (let ((nres (nreverse res)))
(setq mode-line-format nres)
(setq-default mode-line-format nres)))
(force-mode-line-update t)) (force-mode-line-update t))
(defun winum--clear-mode-line () (defun winum--clear-mode-line ()
@ -430,7 +432,9 @@ POSITION: position in the mode-line."
(unless (equal item winum--mode-line-segment) (unless (equal item winum--mode-line-segment)
(push item res))) (push item res)))
(pop mode-line)) (pop mode-line))
(setq-default mode-line-format (nreverse res))) (let ((nres (nreverse res)))
(setq mode-line-format nres)
(setq-default mode-line-format nres)))
(force-mode-line-update t)) (force-mode-line-update t))
(defun winum--update () (defun winum--update ()