diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2024-12-19 09:19:58 +0100 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2024-12-19 09:19:58 +0100 |
| commit | 184d0074e852af4967e386f0fc4fcfd94588d17e (patch) | |
| tree | ce237b88c39ace11b076560a0c9ad8ea3520e0f9 | |
| parent | a45ac411526030ad601a384c4c293af18bd2db75 (diff) | |
Store parent group in suffix and subgroup objects
| -rw-r--r-- | docs/transient.org | 2 | ||||
| -rw-r--r-- | docs/transient.texi | 5 | ||||
| -rw-r--r-- | lisp/transient.el | 13 |
3 files changed, 16 insertions, 4 deletions
diff --git a/docs/transient.org b/docs/transient.org index b49e8dd..6dce552 100644 --- a/docs/transient.org +++ b/docs/transient.org @@ -2236,6 +2236,8 @@ This is the abstract superclass of ~transient-suffix~ and ~transient-group~. This is where the shared ~if*~ and ~inapt-if*~ slots (see [[*Predicate Slots]]) and the ~level~ slot (see [[*Enabling and Disabling Suffixes]]) are defined. +- ~parent~ The object for the parent group. + *** Slots of ~transient-suffix~ :PROPERTIES: :UNNUMBERED: notoc diff --git a/docs/transient.texi b/docs/transient.texi index 7b9f3a4..8157f72 100644 --- a/docs/transient.texi +++ b/docs/transient.texi @@ -2520,6 +2520,11 @@ This is the abstract superclass of @code{transient-suffix} and @code{transient-g This is where the shared @code{if*} and @code{inapt-if*} slots (see @ref{Predicate Slots}) and the @code{level} slot (see @ref{Enabling and Disabling Suffixes}) are defined. +@itemize +@item +@code{parent} The object for the parent group. +@end itemize + @anchor{Slots of @code{transient-suffix}} @subheading Slots of @code{transient-suffix} diff --git a/lisp/transient.el b/lisp/transient.el index 97ed871..a3207c2 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -747,7 +747,11 @@ the prototype is stored in the clone's `prototype' slot.") ;;;; Suffix (defclass transient-child () - ((level + ((parent + :initarg :parent + :initform nil + :documentation "The parent group object.") + (level :initarg :level :initform (symbol-value 'transient--default-child-level) :documentation "Enable if level of prefix is equal or greater.") @@ -2254,7 +2258,7 @@ value. Otherwise return CHILDREN as is.") (defun transient--init-group (levels spec parent) (pcase-let ((`(,level ,class ,args ,children) (append spec nil))) (and-let* (((transient--use-level-p level)) - (obj (apply class :level level args)) + (obj (apply class :parent parent :level level args)) ((transient--use-suffix-p obj)) ((prog1 t (when (or (and parent (oref parent inapt)) @@ -2280,12 +2284,13 @@ value. Otherwise return CHILDREN as is.") (autoload-do-load fn))) (when (transient--use-level-p level) (let ((obj (if (child-of-class-p class 'transient-information) - (apply class :level level args) + (apply class :parent parent :level level args) (unless (and cmd (symbolp cmd)) (error "BUG: Non-symbolic suffix command: %s" cmd)) (if-let ((proto (and cmd (transient--suffix-prototype cmd)))) (apply #'clone proto :level level args) - (apply class :command cmd :level level args))))) + (apply class :command cmd :parent parent :level level + args))))) (cond ((not cmd)) ((commandp cmd)) ((or (cl-typep obj 'transient-switch) |
