[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient 93b5088ffd 050/366: Highlight the active infi
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient 93b5088ffd 050/366: Highlight the active infix while reading its value from the user |
Date: |
Tue, 25 Jan 2022 18:54:25 -0500 (EST) |
branch: externals/transient
commit 93b5088ffd5671b3eb4f64c2ebdf01143ff362fe
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Highlight the active infix while reading its value from the user
Closes #30.
---
lisp/transient.el | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index bc0dc6ec35..6b41acd971 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -297,6 +297,10 @@ give you as many additional suffixes as you hoped.)"
"Face used for suffixes unreachable from the current prefix sequence."
:group 'transient-faces)
+(defface transient-active-infix '((t :inherit secondary-selection))
+ "Face used for the infix for which the value is being read."
+ :group 'transient-faces)
+
(defface transient-unreachable-key '((t :inherit shadow))
"Face used for keys unreachable from the current prefix sequence."
:group 'transient-faces)
@@ -979,6 +983,8 @@ variable instead.")
(defvar transient--helpp nil "Whether help-mode is active.")
(defvar transient--editp nil "Whether edit-mode is active.")
+(defvar transient--active-infix nil "The active infix awaiting user input.")
+
(defvar transient--timer nil)
(defvar transient--stack nil)
@@ -2010,10 +2016,13 @@ infix command determines what the new value should be,
based
on the previous value.")
(cl-defmethod transient-infix-read :around ((obj transient-infix))
- "Exit the transient in case of an error.
+ "Highlight the infix in the popup buffer.
-Without this Emacs would get stuck in an inconsistent state,
+Also arrange for the transient to be exited in case of an error
+because otherwise Emacs would get stuck in an inconsistent state,
which might make it necessary to kill it from the outside."
+ (let ((transient--active-infix obj))
+ (transient--show))
(transient--with-emergency-exit
(cl-call-next-method obj)))
@@ -2357,9 +2366,11 @@ have a history of their own.")
(cl-defmethod transient--insert-group ((group transient-column))
(dolist (suffix (oref group suffixes))
- (insert (transient-format suffix))
- (unless (integerp suffix)
- (insert ?\n))))
+ (let ((str (transient-format suffix)))
+ (insert str)
+ (unless (or (integerp suffix)
+ (string-match-p ".\n\\'" str))
+ (insert ?\n)))))
(cl-defmethod transient--insert-group ((group transient-columns))
(let* ((columns
@@ -2410,6 +2421,15 @@ making `transient--source-buffer' current.")
"Return a string containing just the ARG character."
(char-to-string arg))
+(cl-defmethod transient-format :around ((obj transient-infix))
+ "When reading user input for this infix, then highlight it."
+ (let ((str (cl-call-next-method obj)))
+ (when (eq obj transient--active-infix)
+ (setq str (concat str "\n"))
+ (add-face-text-property 0 (length str)
+ 'transient-active-infix nil str))
+ str))
+
(cl-defmethod transient-format :around ((obj transient-suffix))
"When edit-mode is enabled, then prepend the level information."
(concat (and transient--editp
- [elpa] externals/transient 69f42f9e89 334/366: transient--make-predicate-map: Cosmetics, (continued)
- [elpa] externals/transient 69f42f9e89 334/366: transient--make-predicate-map: Cosmetics, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 8d8ed1965f 345/366: Hide infix commands from execute-extended-command, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 22e032ae65 343/366: Move obsolete variable declaration, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 804feb3b41 361/366: transient--{push, pop}-keymap: Do nothing if keymap is void, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 6d721f7490 348/366: Don't use convert-standard-filename when defining path variables, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 2c9cef1f5a 352/366: Bump copyright years, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 427e36046a 131/366: transient-force-fixed-pitch: New option, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 95389b31ec 137/366: transient-init-value: Always prefer saved over default value, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 700719723d 047/366: magit--history-push: Add optional SLOT argument, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 919fc6653d 048/366: transient--make-predicate-map: Always respect transient slot, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 93b5088ffd 050/366: Highlight the active infix while reading its value from the user,
Jonas Bernoulli <=
- [elpa] externals/transient 32459a4dde 074/366: Bring back arrow key navigation in transient popups, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 23fab3a114 075/366: Bring back mouse support in transient popups, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient b52c9652fa 077/366: Update manual, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient dcf7a4dc62 084/366: transient-read-with-initial-input: New option, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient fd9e9bfe26 088/366: transient--layout-member-1: New function, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient ac02efc119 157/366: transient--scroll-commands: New variable, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 9683e8add2 165/366: transient--do-suffix-p: New function, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient ec2de622d2 171/366: transient-suffix-object: Check type of argument, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient bcd07e065b 172/366: transient--suffix-symbol: Split from transient--suffix-command, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 293a437d66 206/366: Support padding of keys regardless of the group's class, Jonas Bernoulli, 2022/01/25