@@ -860,12 +860,15 @@ with an example:
860860#+end_src
861861
862862This inserts a new infix argument to toggle the ~--reverse~ argument
863- after the infix argument that toggles ~-3~ in ~magit-patch-apply~.
863+ after the infix argument that is bound to ~-3~ in ~magit-patch-apply~.
864864
865865The following functions share a few arguments:
866866
867867- {{{var(PREFIX)}}} is a transient prefix command, a symbol.
868868
869+ PREFIX may also by a symbol identify a separately defined group,
870+ which can be included in multiple prefixes. See TODO.
871+
869872- {{{var(SUFFIX)}}} is a transient infix or suffix specification in the same form
870873 as expected by ~transient-define-prefix~. Note that an infix is a
871874 special kind of suffix. Depending on context “suffixes” means
@@ -876,23 +879,23 @@ The following functions share a few arguments:
876879 ~transient-define-prefix~. See [[*Group Specifications]].
877880
878881- {{{var(LOC)}}} is a command, a key description (a string as returned by
879- ~key-description~ and understood by ~kbd~), or a list specifying
882+ ~key-description~ and understood by ~kbd~), or a vector specifying
880883 coordinates (the last element may also be a command or key). For
881- example ~( 1 0 -1) ~ identifies the last suffix (~-1~) of the first
884+ example ~[ 1 0 -1] ~ identifies the last suffix (~-1~) of the first
882885 subgroup (~0~) of the second group (~1~).
883886
884- If {{{var(LOC)}}} is a list of coordinates , then it can be used to identify a
885- group, not just an individual suffix command.
887+ If {{{var(LOC)}}} is a vector , then it can be used to identify a group, not
888+ just an individual suffix command.
886889
887890 The function ~transient-get-suffix~ can be useful to determine whether
888891 a certain coordination list identifies the suffix or group that you
889892 expect it to identify. In hairy cases it may be necessary to look
890- at the definition of the transient prefix command.
893+ at the internal layout representation, which you can access using
894+ the function ~transient--get-layout~.
891895
892896These functions operate on the information stored in the
893897~transient--layout~ property of the {{{var(PREFIX)}}} symbol. Suffix entries in
894- that tree are not objects but have the form {{{codevar((LEVEL CLASS PLIST))}}}, where
895- {{{var(PLIST)}}} should set at least ~:key~, ~:description~ and ~:command~.
898+ that tree are not objects but have the form {{{codevar((CLASS PLIST))}}}.
896899
897900- Function: transient-insert-suffix prefix loc suffix &optional keep-other ::
898901- Function: transient-append-suffix prefix loc suffix &optional keep-other ::
@@ -930,6 +933,19 @@ that tree are not objects but have the form {{{codevar((LEVEL CLASS PLIST))}}},
930933 This function edits the suffix or group at {{{var(LOC)}}} in {{{var(PREFIX)}}}, by setting
931934 the {{{var(PROP)}}} of its plist to {{{var(VALUE)}}}.
932935
936+ Some prefix commands share suffixes, which are seperately and then
937+ included in each prefix when it is defined. The inclusion is done by
938+ reference, the included suffix groups are not inlined by default. So
939+ if you change, for example, the key binding for an argument in
940+ ~magit-diff~ (~d~) the same change also applies to ~magit-diff-refresh~ (~D~).
941+ In the rare case that this is not desirable use ~transient-inline-group~
942+ before making changes to included suffixes.
943+
944+ - Function: transient-inline-group PREFIX GROUP ::
945+
946+ This function inlines the included GROUP into PREFIX, by replacing
947+ the symbol GROUP with its expanded layout in the layout of PREFIX.
948+
933949Most of these functions do not signal an error if they cannot perform
934950the requested modification. The functions that insert new suffixes
935951show a warning if {{{var(LOC)}}} cannot be found in {{{var(PREFIX,)}}} without signaling an
@@ -1095,6 +1111,22 @@ that is used to invoke that transient.
10951111 For example, the scope of the ~magit-branch-configure~ transient is
10961112 the branch whose variables are being configured.
10971113
1114+ Sometimes multiple prefix commands share a common set of suffixes.
1115+ For example, while ~magit-diff~ (~d~) and ~magit-diff-refresh~ (~D~) offer
1116+ different suffixes to actually create or update a diff, they both
1117+ offer the same infix arguments to control how that diff is formatted.
1118+ Such shared groups should be defined using ~transient-define-group~
1119+ and then included in mulitple prefixes, by using the symbol that
1120+ identifies the group in the prefix definition, in a location where
1121+ you would otherwise use a group vector. If an included group is
1122+ placed at the top-level of a prefix (as opposed of inside inside
1123+ a vector as a child group), then the symbol should be quoted.
1124+
1125+ - Macro: transient-define-group name group... ::
1126+
1127+ This macro define one or more groups and stores them in symbol NAME.
1128+ GROUPs have the same form as for ~transient-define-prefix~.
1129+
10981130** Binding Suffix and Infix Commands
10991131
11001132The macro ~transient-define-prefix~ is used to define a transient.
0 commit comments