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

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

[nongnu] elpa/keycast 44f53d7cc6 10/31: Limit updating of mode-line


From: ELPA Syncer
Subject: [nongnu] elpa/keycast 44f53d7cc6 10/31: Limit updating of mode-line
Date: Sun, 9 Jan 2022 05:58:39 -0500 (EST)

branch: elpa/keycast
commit 44f53d7cc62342d48fcba4d555ab204c8d7e482a
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    Limit updating of mode-line
    
    Merely loading the library resulted in `keycast-mode-line-update'
    being added to `pre-command-hook', which was clearly unnecessary.
    Now the mode `keycast-mode' controls whether the hook function is
    used.
    
    Additionally only update the mode-line of the current buffer, by
    calling `forge-mode-line-update' without the ALL argument.
    
    The purpose of these changes isn't merely to reduce waste.  Forcing
    all mode-lines to be updated causes `old-selected-window' to return
    a different value, which causes issues for moody when the user moves
    away from the still active minibuffer.
---
 keycast.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/keycast.el b/keycast.el
index 23aca2f59c..2c3b6b3108 100644
--- a/keycast.el
+++ b/keycast.el
@@ -160,9 +160,7 @@ instead."
   ;; values have been reset to nil.
   (setq keycast--this-command-keys (this-command-keys))
   (setq keycast--this-command this-command)
-  (force-mode-line-update t))
-
-(add-hook 'pre-command-hook 'keycast-mode-line-update t)
+  (force-mode-line-update))
 
 (defvar keycast--removed-tail nil)
 
@@ -182,7 +180,8 @@ instead."
                (setq keycast--removed-tail (cdr cons))
                (setcdr cons (list 'mode-line-keycast)))
               (t
-               (setcdr cons (cons 'mode-line-keycast (cdr cons))))))
+               (setcdr cons (cons 'mode-line-keycast (cdr cons)))))
+        (add-hook 'pre-command-hook 'keycast-mode-line-update t))
     (let ((cons (memq 'mode-line-keycast mode-line-format)))
       (cond (keycast--removed-tail
              (setcar cons (car keycast--removed-tail))
@@ -190,7 +189,8 @@ instead."
             (t
              (setcar cons (cadr cons))
              (setcdr cons (cddr cons)))))
-    (setq keycast--removed-tail nil)))
+    (setq keycast--removed-tail nil)
+    (remove-hook 'pre-command-hook 'keycast-mode-line-update)))
 
 (defun keycast-bottom-right-window-p ()
   (and (window-at-side-p nil 'right)



reply via email to

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