[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/keycast cf475dcb5a 18/31: keycast--format: New function
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/keycast cf475dcb5a 18/31: keycast--format: New function |
Date: |
Sun, 9 Jan 2022 05:58:45 -0500 (EST) |
branch: elpa/keycast
commit cf475dcb5a0517d479ee4eebfff6cc9d42b7ac0d
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
keycast--format: New function
---
keycast.el | 53 ++++++++++++++++++++++++++++-------------------------
1 file changed, 28 insertions(+), 25 deletions(-)
diff --git a/keycast.el b/keycast.el
index 256a6f3e8c..b348786443 100644
--- a/keycast.el
+++ b/keycast.el
@@ -178,6 +178,33 @@ instead."
(setq keycast--this-command this-command)
(force-mode-line-update))
+(defun keycast--format (format)
+ (and (not keycast--reading-passwd)
+ (let* ((key (ignore-errors
+ (key-description keycast--this-command-keys)))
+ (cmd keycast--this-command)
+ (elt (or (assoc cmd keycast-substitute-alist)
+ (assoc key keycast-substitute-alist))))
+ (when elt
+ (pcase-let ((`(,_ ,k ,c) elt))
+ (unless (eq k t) (setq key k))
+ (unless (eq c t) (setq cmd c))))
+ (and key cmd
+ (let ((k (let ((pad (max 2 (- 5 (length key)))))
+ (concat (make-string (ceiling pad 2) ?\s) key
+ (make-string (floor pad 2) ?\s))))
+ (c (format " %s" cmd)))
+ (format-spec
+ format
+ `((?s . ,(make-string keycast-separator-width ?\s))
+ (?k . ,(propertize k 'face 'keycast-key))
+ (?K . ,k)
+ (?c . ,(propertize c 'face 'keycast-command))
+ (?C . ,c)
+ (?r . ,(if (> keycast--command-repetitions 0)
+ (format " x%s" (1+ keycast--command-repetitions))
+ "")))))))))
+
(defvar keycast--removed-tail nil)
;;;###autoload
@@ -234,31 +261,7 @@ instead."
(defvar mode-line-keycast
'(:eval
(and (funcall keycast-window-predicate)
- (not keycast--reading-passwd)
- (let* ((key (ignore-errors
- (key-description keycast--this-command-keys)))
- (cmd keycast--this-command)
- (elt (or (assoc cmd keycast-substitute-alist)
- (assoc key keycast-substitute-alist))))
- (when elt
- (pcase-let ((`(,_ ,k ,c) elt))
- (unless (eq k t) (setq key k))
- (unless (eq c t) (setq cmd c))))
- (and key cmd
- (let ((k (let ((pad (max 2 (- 5 (length key)))))
- (concat (make-string (ceiling pad 2) ?\s) key
- (make-string (floor pad 2) ?\s))))
- (c (format " %s" cmd)))
- (format-spec
- mode-line-keycast-format
- `((?s . ,(make-string keycast-separator-width ?\s))
- (?k . ,(propertize k 'face 'keycast-key))
- (?K . ,k)
- (?c . ,(propertize c 'face 'keycast-command))
- (?C . ,c)
- (?r . ,(if (> keycast--command-repetitions 0)
- (format " x%s" (1+
keycast--command-repetitions))
- ""))))))))))
+ (keycast--format mode-line-keycast-format))))
(put 'mode-line-keycast 'risky-local-variable t)
(make-variable-buffer-local 'mode-line-keycast)
- [nongnu] branch elpa/keycast created (now a5257bca3d), ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast b7ef571043 11/31: Fix typo, ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast 8970a30273 12/31: Revert "Add .github/FUNDING.yml", ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast c64742ee21 01/31: Initial import, ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast 16d9961d15 16/31: Add format-spec requirement, ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast 464bae181f 05/31: Show counter if a command is invoked more than once in a row, ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast 7c45ff05c1 06/31: Fix typo in doc-string, ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast cf475dcb5a 18/31: keycast--format: New function,
ELPA Syncer <=
- [nongnu] elpa/keycast 7bbebe6442 08/31: Add .github/FUNDING.yml, ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast 44f53d7cc6 10/31: Limit updating of mode-line, ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast b02892ec77 24/31: Show only type for non-symbol bindings, ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast 3beccc4789 26/31: Load compile-time dependencies for older Emacsen, ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast a5257bca3d 31/31: Release version 1.1.2, ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast d54a8ebc08 27/31: Restore updating while in minibuffer, ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast 0d28c26b07 02/31: Fix typo, ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast 46370b8a72 03/31: Change screenshot url, ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast adb55497c0 13/31: Bump copyright years, ELPA Syncer, 2022/01/09
- [nongnu] elpa/keycast ab41be43b6 09/31: Suppress output while reading password, ELPA Syncer, 2022/01/09