branch: elpa/keycast
commit a912c4db1b88390f76b14e3b47ded314fdc8f48c
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
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)))