summaryrefslogtreecommitdiff
path: root/lisp/transient.el
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2026-02-23 10:46:02 +0100
committerJonas Bernoulli <jonas@bernoul.li>2026-02-23 10:46:02 +0100
commit038d8ce1e5ec353b6196bd660572eeb53654fe2a (patch)
tree52494413bd2a3cdc9e078410ead8de2662b31bc7 /lisp/transient.el
parent8b057d82865a75ba22a499e52b68ad73913e9de0 (diff)
transient-get-summary: Support all object types
Remove the stub implementations and instead teach the method previously only used for most `transient-suffix' to also support `transient-prefix', `transient-group' and all subclasses of `transient-suffix'.
Diffstat (limited to 'lisp/transient.el')
-rw-r--r--lisp/transient.el23
1 files changed, 11 insertions, 12 deletions
diff --git a/lisp/transient.el b/lisp/transient.el
index c97cf77..af4cae9 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -850,6 +850,7 @@ If `transient-save-history' is nil, then do nothing."
(show-help :initarg :show-help :initform nil)
(info-manual :initarg :info-manual :initform nil)
(man-page :initarg :man-page :initform nil)
+ (summary :initarg :summary :initform nil)
(transient-suffix :initarg :transient-suffix :initform nil)
(transient-non-suffix :initarg :transient-non-suffix :initform nil)
(transient-switch-frame :initarg :transient-switch-frame)
@@ -962,7 +963,10 @@ the prototype is stored in the clone's `prototype' slot.")
(advice*
:initarg :advice*
:initform nil
- :documentation "Advise applied to the command body and interactive spec."))
+ :documentation "Advise applied to the command body and interactive spec.")
+ (summary
+ :initarg :summary
+ :initform nil))
"Abstract superclass for group and suffix classes.
It is undefined which predicates are used if more than one `if*'
@@ -977,8 +981,7 @@ predicate slots or more than one `inapt-if*' slots are non-nil."
(format :initarg :format :initform " %k %d")
(description :initarg :description :initform nil)
(face :initarg :face :initform nil)
- (show-help :initarg :show-help :initform nil)
- (summary :initarg :summary :initform nil))
+ (show-help :initarg :show-help :initform nil))
"Superclass for suffix command.")
(defclass transient-information (transient-suffix)
@@ -5260,19 +5263,15 @@ of the documentation string, if any.
If RETURN is non-nil, return the summary instead of showing it.
This is used when a tooltip is needed.")
-(cl-defmethod transient-get-summary ((_obj transient-prefix)))
-
-(cl-defmethod transient-get-summary ((_obj transient-group)))
-
-(cl-defmethod transient-get-summary ((_obj transient-information)))
-
-(cl-defmethod transient-get-summary ((obj transient-suffix))
- (with-slots (command summary) obj
+(cl-defmethod transient-get-summary ((obj transient-object))
+ (let ((summary (oref obj summary))
+ (command (ignore-error (invalid-slot-name unbound-slot)
+ (oref obj command))))
(when-let*
((doc (cond ((functionp summary)
(funcall summary obj))
(summary)
- ((documentation command)
+ ((and command (documentation command))
(car (split-string (documentation command) "\n")))))
(_(stringp doc))
(_(not (equal doc