From d7b7eecf0860c63eab9cc4013d08e2a4a83fcc5e Mon Sep 17 00:00:00 2001 From: Tomasz Mieszkowski Date: Sun, 4 Nov 2018 19:49:34 +0100 Subject: [PATCH] Don't push winum to mode-line if it's already there Fixes #17 --- winum.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/winum.el b/winum.el index a6b51c8..c9444f4 100644 --- a/winum.el +++ b/winum.el @@ -408,11 +408,12 @@ WINDOW: if specified, the window of which we want to know the number. "Install the window number from `winum-mode' to the mode-line. POSITION: position in the mode-line." (let ((mode-line (default-value 'mode-line-format)) - (res)) + res) (dotimes (i (min (or position winum-mode-line-position 1) (length mode-line))) (push (pop mode-line) res)) - (push '(:eval (winum-get-number-string)) res) + (unless (equal (car mode-line) '(:eval (winum-get-number-string))) + (push '(:eval (winum-get-number-string)) res)) (while mode-line (push (pop mode-line) res)) (setq-default mode-line-format (nreverse res)))