[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/keycast f87f9c965e 06/10: keycast-mode-line-mode: Support
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/keycast f87f9c965e 06/10: keycast-mode-line-mode: Support buffers with local mode-line-format |
Date: |
Mon, 5 Dec 2022 06:59:12 -0500 (EST) |
branch: elpa/keycast
commit f87f9c965ec7646da09431e69c4bddb70514d896
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
keycast-mode-line-mode: Support buffers with local mode-line-format
---
keycast.el | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/keycast.el b/keycast.el
index ff8850f8e5..a62eeab2ee 100644
--- a/keycast.el
+++ b/keycast.el
@@ -330,12 +330,31 @@ t to show the actual COMMAND, or a symbol to be shown
instead."
(< keycast--command-repetitions 0))
(cl-incf keycast--command-repetitions)
(setq keycast--command-repetitions 0)))
+ (when keycast-mode-line-mode
+ (keycast--maybe-edit-local-format
+ 'mode-line-format
+ 'keycast-mode-line
+ 'keycast--mode-line-modified-buffers))
(when (and keycast-log-mode
(not keycast--reading-passwd))
(keycast-log-update-buffer))
(when (keycast--mode-active-p 'line)
(force-mode-line-update (minibufferp))))
+(defun keycast--maybe-edit-local-format (format item record)
+ (let ((value (buffer-local-value format (current-buffer))))
+ (unless (and (listp value)
+ (memq item value))
+ (set record (cons (current-buffer) (symbol-value record)))
+ (set format (if (keycast--format-atom-p value)
+ (list "" item value)
+ (nconc (list "" item) value))))))
+
+(defun keycast--format-atom-p (format)
+ (or (stringp format)
+ (and (not (stringp (car-safe format)))
+ (not (listp (car-safe format))))))
+
(defun keycast--format (format)
(and (not keycast--reading-passwd)
(let* ((key (ignore-errors
@@ -393,6 +412,7 @@ t to show the actual COMMAND, or a symbol to be shown
instead."
(defvar keycast--removed-tail nil)
(defvar keycast--temporary-mode-line nil)
+(defvar keycast--mode-line-modified-buffers nil)
(defalias 'keycast-mode 'keycast-mode-line-mode)
@@ -435,6 +455,11 @@ t to show the actual COMMAND, or a symbol to be shown
instead."
(t
(setcar cons (cadr cons))
(setcdr cons (cddr cons)))))
+ (dolist (buf keycast--mode-line-modified-buffers)
+ (when (buffer-live-p buf)
+ (with-current-buffer buf
+ (setq-local mode-line-format
+ (delq 'keycast-mode-line mode-line-format)))))
(unless (keycast--mode-active-p)
(remove-hook 'post-command-hook #'keycast--update)
(remove-hook 'minibuffer-exit-hook #'keycast--minibuffer-exit)))))
- [nongnu] elpa/keycast updated (92a14313fe -> 53514c3dc3), ELPA Syncer, 2022/12/05
- [nongnu] elpa/keycast 36d7bfa75f 09/10: keycast-header-line-mode: New mode, ELPA Syncer, 2022/12/05
- [nongnu] elpa/keycast 81bad0faa8 08/10: keycast--tree-member: Move definition, ELPA Syncer, 2022/12/05
- [nongnu] elpa/keycast 860b0781a4 05/10: keycast-mode-line-mode: Support atomic and void global mode-line-format, ELPA Syncer, 2022/12/05
- [nongnu] elpa/keycast 1c92a5daf5 02/10: Rename keycast-mode to keycast-mode-line-mode, ELPA Syncer, 2022/12/05
- [nongnu] elpa/keycast f87f9c965e 06/10: keycast-mode-line-mode: Support buffers with local mode-line-format,
ELPA Syncer <=
- [nongnu] elpa/keycast 3df44bd9e7 04/10: keycast-mode-line-mode: Make sure to modify global mode-line-format, ELPA Syncer, 2022/12/05
- [nongnu] elpa/keycast 53514c3dc3 10/10: Update documentation, ELPA Syncer, 2022/12/05
- [nongnu] elpa/keycast 31446ad19c 01/10: Split Options section into subsections, ELPA Syncer, 2022/12/05
- [nongnu] elpa/keycast 3367c7d375 07/10: keycast--removed-tail: Rename to keycast--header-line-removed-tail, ELPA Syncer, 2022/12/05
- [nongnu] elpa/keycast 38a09aa5e3 03/10: keycast-mode-line-mode: Cosmetics, ELPA Syncer, 2022/12/05