[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient 71399d21c5 30/41: transient-format: No longer
|
From: |
Jonas Bernoulli |
|
Subject: |
[elpa] externals/transient 71399d21c5 30/41: transient-format: No longer apply face for inapt bindings here |
|
Date: |
Sun, 12 Nov 2023 20:04:09 -0500 (EST) |
branch: externals/transient
commit 71399d21c52048cc809dd848a71dbe3887b93acf
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
transient-format: No longer apply face for inapt bindings here
Apply a face individually for the key and the description. For the
key, always use `transient-inapt-suffix'. For the description honor
the new `inapt-face' slot.
Some suffixes are inapt because they represent the current state and
invoking them therefore wouldn't makes sense. In that case we likely
want to highlight them, instead of dimming them.
---
lisp/transient.el | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index d4af5c94f9..d642ba5d11 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -716,6 +716,7 @@ slot is non-nil."
(description :initarg :description :initform nil)
(face :initarg :face :initform nil)
(show-help :initarg :show-help :initform nil)
+ (inapt-face :initarg :inapt-face :initform 'transient-inapt-suffix)
(inapt :initform nil)
(inapt-if
:initarg :inapt-if
@@ -3617,8 +3618,6 @@ Optional support for popup buttons is also implemented
here."
'transient-enabled-suffix
'transient-disabled-suffix))))
(cl-call-next-method obj))))
- (when (oref obj inapt)
- (add-face-text-property 0 (length str) 'transient-inapt-suffix nil str))
(if transient-enable-popup-navigation
(make-text-button str nil
'type 'transient
@@ -3646,6 +3645,12 @@ Optional support for popup buttons is also implemented
here."
(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))
+ (let ((str (cl-call-next-method)))
+ (when (oref obj inapt)
+ (add-face-text-property 0 (length str) 'transient-inapt-suffix nil str))
+ 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) ""))
@@ -3744,7 +3749,11 @@ If the OBJ's `key' is currently unreachable, then apply
the face
(funcall (oref transient--prefix suffix-description)
obj))
(propertize "(BUG: no description)" 'face 'error))))
- (cond ((and (slot-boundp obj 'key)
+ (cond ((oref obj inapt)
+ (when-let ((face (oref obj inapt-face)))
+ (add-face-text-property 0 (length desc) face nil desc))
+ desc)
+ ((and (slot-boundp obj 'key)
(transient--key-unreachable-p obj))
(propertize desc 'face 'transient-unreachable))
((if transient--all-levels-p
- [elpa] externals/transient d44c4fce39 40/41: transient--get-face: Use for inapt-face, (continued)
- [elpa] externals/transient d44c4fce39 40/41: transient--get-face: Use for inapt-face, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient eaf062a921 11/41: transient--make-predicate-map: Refactor, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 5ad5b627f6 15/41: transient--setup-recursion: When initiated by outer transient-suffix, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 2b7219cf6a 28/41: transient--current-buffer: Fix obsolete variable alias, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 0a0ba1aa90 01/41: transient--do-leave: Actually behave as documented, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 8bfd92993f 17/41: manual: Update "Transient State" section, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 0dda40e8b6 27/41: transient-with-shadowed-buffer: New macro, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient b1d1c36966 37/41: Prevent temporary faces from leaking back into objects, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient ef02586712 03/41: transient--invalid: Remove message about former heisenbug, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient a2ff9bc5a3 16/41: transient--stack-push: Preserve value of transient-suffix slot, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 71399d21c5 30/41: transient-format: No longer apply face for inapt bindings here,
Jonas Bernoulli <=
- [elpa] externals/transient 3cd1de1695 41/41: Make shadowed buffer current around forge-format{, -description}, Jonas Bernoulli, 2023/11/12