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

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

[nongnu] elpa/anzu 81b4eb6e29 093/288: Fix increasing anzu information i


From: ELPA Syncer
Subject: [nongnu] elpa/anzu 81b4eb6e29 093/288: Fix increasing anzu information in mode-line issue(#13)
Date: Thu, 6 Jan 2022 03:58:43 -0500 (EST)

branch: elpa/anzu
commit 81b4eb6e2930fcce7dfc9e99cb103d94390d568d
Author: Syohei YOSHIDA <syohex@gmail.com>
Commit: Syohei YOSHIDA <syohex@gmail.com>

    Fix increasing anzu information in mode-line issue(#13)
    
    anzu.el assumes anzu information is first element of mode-line-format.
    anzu.el decides there is no anzu information if first element of
    mode-line-format is not anzu information. But this is sometimes wrong.
    
    If some element is consed mode-line-format during anzu information showing,
    anzu.el mistakes that there is no anzu information and cons anzu information
    again to mode-line-format. This causes increasing anzu information.
    
    So I fixed anzu.el checks whether there is anzu information in 
mode-line-format
    by 'member' function and remove anzu information from mode-line-format by
    'delete' function.
---
 anzu.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/anzu.el b/anzu.el
index 7a49a14670..fd58df937a 100644
--- a/anzu.el
+++ b/anzu.el
@@ -194,9 +194,11 @@
               anzu--last-isearch-string isearch-string)
         (force-mode-line-update)))))
 
+(defconst anzu--mode-line-format '(:eval (anzu--update-mode-line)))
+
 (defsubst anzu--mode-line-not-set-p ()
   (and (listp mode-line-format)
-       (equal (car mode-line-format) '(:eval (anzu--update-mode-line)))))
+       (member anzu--mode-line-format mode-line-format)))
 
 (defun anzu--cons-mode-line-search ()
   (anzu--cons-mode-line 'search))
@@ -204,8 +206,7 @@
 (defun anzu--cons-mode-line (state)
   (setq anzu--state state)
   (when (and anzu-cons-mode-line-p (not (anzu--mode-line-not-set-p)))
-    (setq mode-line-format (cons '(:eval (anzu--update-mode-line))
-                                 mode-line-format))))
+    (setq mode-line-format (cons anzu--mode-line-format mode-line-format))))
 
 (defsubst anzu--reset-status ()
   (setq anzu--total-matched 0
@@ -217,7 +218,7 @@
 (defun anzu--reset-mode-line ()
   (anzu--reset-status)
   (when (and anzu-cons-mode-line-p (anzu--mode-line-not-set-p))
-    (setq mode-line-format (cdr mode-line-format))))
+    (setq mode-line-format (delete anzu--mode-line-format mode-line-format))))
 
 (defsubst anzu--format-here-position (here total)
   (if (and anzu--overflow-p (zerop here))



reply via email to

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