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

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

[nongnu] elpa/keycast a912c4db1b 14/31: Locate keycast-insert-after anyw


From: ELPA Syncer
Subject: [nongnu] elpa/keycast a912c4db1b 14/31: Locate keycast-insert-after anywhere in mode-line-format
Date: Sun, 9 Jan 2022 05:58:43 -0500 (EST)

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

    Locate keycast-insert-after anywhere in mode-line-format
    
    Closes #11.
---
 keycast.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/keycast.el b/keycast.el
index 001ea341e7..e9f269171c 100644
--- a/keycast.el
+++ b/keycast.el
@@ -169,7 +169,7 @@ instead."
   "Show current command and its key binding in the mode line."
   :global t
   (if keycast-mode
-      (let ((cons (member keycast-insert-after mode-line-format)))
+      (let ((cons (keycast--tree-member keycast-insert-after 
mode-line-format)))
         (unless cons
           (setq keycast-mode nil)
           (user-error
@@ -192,6 +192,14 @@ instead."
     (setq keycast--removed-tail nil)
     (remove-hook 'pre-command-hook 'keycast-mode-line-update)))
 
+(defun keycast--tree-member (elt tree)
+  (or (member elt tree)
+      (catch 'found
+        (dolist (sub tree)
+          (when-let ((found (and (listp sub)
+                                 (keycast--tree-member elt sub))))
+            (throw 'found found))))))
+
 (defun keycast-bottom-right-window-p ()
   (and (window-at-side-p nil 'right)
        (window-at-side-p nil 'bottom)))



reply via email to

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