branch: externals/transient commit 99a68578df4d938598d0fcbb8401e2fe35be6132 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
transient-format-description(suffix): Move fontification to around method Like for other fontification work already performed in the around method, this means that specialized primary methods of derived classes, do not have to duplicate the code necessary to do this. As a result, primary methods can no longer prevent fontification by simply not doing it, but that is not a problem because fontification can be prevented by leaving the `face' slot unbound, or by setting it to nil. --- lisp/transient.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/transient.el b/lisp/transient.el index 8d48386de4..b399b9a3a3 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -3941,10 +3941,7 @@ as a button." "The `description' slot may be a function, in which case that is called inside the correct buffer (see `transient--insert-group') and its value is returned to the caller." - (and-let* ((desc (transient--get-description obj))) - (if-let* ((face (transient--get-face obj 'face))) - (transient--add-face desc face t) - desc))) + (transient--get-description obj)) (cl-defmethod transient-format-description ((obj transient-group)) "Format the description by calling the next method. If the result @@ -3965,8 +3962,11 @@ If the OBJ's `key' is currently unreachable, then apply the face (let ((desc (or (cl-call-next-method obj) (and (slot-boundp transient--prefix 'suffix-description) (funcall (oref transient--prefix suffix-description) - obj)) - (propertize "(BUG: no description)" 'face 'error)))) + obj))))) + (if desc + (when-let ((face (transient--get-face obj 'face))) + (setq desc (transient--add-face desc face t))) + (setq desc (propertize "(BUG: no description)" 'face 'error))) (when (if transient--all-levels-p (> (oref obj level) transient--default-prefix-level) (and transient-highlight-higher-levels