[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient a99dcda957 09/23: transient--key-face: Take k
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient a99dcda957 09/23: transient--key-face: Take key into account |
Date: |
Sun, 22 Dec 2024 08:44:39 -0500 (EST) |
branch: externals/transient
commit a99dcda957a5663dcffbb48700eaf332972406b1
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
transient--key-face: Take key into account
[1: fe71a7e7] only did so when determining the transient behavior.
This commit takes care of also properly visualizing that behavior.
- Take an additional KEY argument and pass it along to
`transient--get-pre-command'. The previous commit [2: db9603be]
added that argument to that function.
- No longer prefer the command's `transient-face' symbol property,
which we did since the very first implementation of this feature,
added in [3: 248862c5]. Overriding the automatically determined
face is counterproductive as it would counter binding-specific
changes to the transient behavior and inapt predicate. We don't
actually do this for any commands, so in practice this did not
matter.
- No longer define an around method, the primary method handles it
all. It already did that before this commit.
1: 2024-12-15 fe71a7e7d63c1685d22b59e792c6b67cefebf2af
Account for duplicated commands with different transient behavior
2: 2024-12-16 db9603bef9afc23b7c6df2483cf2295cd3ff34ab
transient--get-pre-command: Change argument order
3: 2020-06-21 248862c58e3bc0c13c6e3315adc2f3bb43c3c476
Add experimental support for semantic coloring
---
lisp/transient.el | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index 0cc84a131b..fd877558af 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -4009,7 +4009,8 @@ have a history of their own.")
(propertize "\n" 'face face 'line-height t))))
(defun transient--prefix-color ()
- (or (face-foreground (transient--key-face nil 'non-suffix) nil t) "#gray60"))
+ (or (face-foreground (transient--key-face nil nil 'non-suffix) nil t)
+ "#gray60"))
(defmacro transient-with-shadowed-buffer (&rest body)
"While in the transient buffer, temporarily make the shadowed buffer
current."
@@ -4161,13 +4162,6 @@ as a button."
(cl-defgeneric transient-format-key (obj)
"Format OBJ's `key' for display and return the result.")
-(cl-defmethod transient-format-key :around ((obj transient-suffix))
- "Add `transient-inapt-suffix' face if suffix is inapt."
- (let ((str (cl-call-next-method)))
- (if (oref obj inapt)
- (transient--add-face str 'transient-inapt-suffix)
- str)))
-
(cl-defmethod transient-format-key ((obj transient-suffix))
"Format OBJ's `key' for display and return the result."
(let ((key (if (slot-boundp obj 'key) (oref obj key) ""))
@@ -4200,16 +4194,16 @@ as a button."
(setq suf (string-replace " " "" suf)))
(concat (propertize pre 'face 'transient-unreachable-key)
(and (string-prefix-p (concat pre " ") key) " ")
- (propertize suf 'face (transient--key-face cmd))
+ (propertize suf 'face (transient--key-face cmd key))
(save-excursion
(and (string-match " +\\'" key)
(propertize (match-string 0 key)
'face 'fixed-pitch))))))
((transient--lookup-key transient-sticky-map (kbd key))
- (propertize key 'face (transient--key-face cmd)))
+ (propertize key 'face (transient--key-face cmd key)))
(t
(propertize key 'face 'transient-unreachable-key))))
- (propertize key 'face (transient--key-face cmd)))))
+ (propertize key 'face (transient--key-face cmd key)))))
(cl-defmethod transient-format-key :around ((obj transient-argument))
"Handle `transient-highlight-mismatched-keys'."
@@ -4358,13 +4352,12 @@ apply the face `transient-unreachable' to the complete
string."
(add-face-text-property (or beg 0) (or end (length str)) face append str)
str))
-(defun transient--key-face (&optional cmd enforce-type)
+(defun transient--key-face (cmd key &optional enforce-type)
(or (and transient-semantic-coloring
(not transient--helpp)
(not transient--editp)
- (or (and cmd (get cmd 'transient-face))
- (get (transient--get-pre-command cmd nil enforce-type)
- 'transient-face)))
+ (get (transient--get-pre-command cmd key enforce-type)
+ 'transient-face))
(if cmd 'transient-key 'transient-key-noop)))
(defun transient--key-unreachable-p (obj)
- [elpa] externals/transient updated (dbe18e3f5e -> 5a18a79100), Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient 5353464bb5 03/23: transient--display-action: No longer restrict pre-prefix function, Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient bf58c0bb1b 01/23: Support using a dedicated frame to display transient buffer, Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient 2146279602 02/23: transient--prefix-color: New function, Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient c35627bf9c 04/23: transient--display-action: Look harder for disallowed function, Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient de98430206 05/23: transient--show: Fix remembering old no-other-window parameter value, Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient a99dcda957 09/23: transient--key-face: Take key into account,
Jonas Bernoulli <=
- [elpa] externals/transient 98c01b846c 20/23: transient-toggle-common: Make transient, Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient 03ef2e7566 19/23: transient-toggle-common: Define using transient-define-suffix, Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient fe71a7e7d6 07/23: Account for duplicated commands with different transient behavior, Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient e1126a6ffc 06/23: transient--display-action: Pre-calculate frame dimensions, Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient eebcbe306c 11/23: Support including a top-level group from a variable, Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient 28347e59c4 12/23: transient--insert-group(:around): Add ignored optional second argument, Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient fd9811ea1a 13/23: transient--fit-window-to-buffer: Also fit horizontally, Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient a45ac41152 15/23: transient--show: No longer redo setup on every refresh, Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient 88031d6891 14/23: transient--delete-window: Ensure buffer is always killed, Jonas Bernoulli, 2024/12/22
- [elpa] externals/transient 667ce2b287 18/23: Use transient-default-value in transient-init-value(suffix), Jonas Bernoulli, 2024/12/22