aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorJonas Bernoulli2025-02-01 18:14:47 +0100
committerJonas Bernoulli2025-02-01 18:14:47 +0100
commit3a86774ce55e9dc4dc6de01f6aca19fcaa41a5d3 (patch)
tree57dc39d0e5eed587f125e4fffd31da2163ad2ae9 /doc
parent5a5706f943ae2677c6d73fed8de11affd3ef04aa (diff)
downloademacs-3a86774ce55e9dc4dc6de01f6aca19fcaa41a5d3.tar.gz
emacs-3a86774ce55e9dc4dc6de01f6aca19fcaa41a5d3.zip
Update to Transient v0.8.4-7-gabee7353
Diffstat (limited to 'doc')
-rw-r--r--doc/misc/transient.texi138
1 files changed, 132 insertions, 6 deletions
diff --git a/doc/misc/transient.texi b/doc/misc/transient.texi
index fb8b6da145c..4740663e987 100644
--- a/doc/misc/transient.texi
+++ b/doc/misc/transient.texi
@@ -31,7 +31,7 @@ General Public License for more details.
31@finalout 31@finalout
32@titlepage 32@titlepage
33@title Transient User and Developer Manual 33@title Transient User and Developer Manual
34@subtitle for version 0.8.3 34@subtitle for version 0.8.4
35@author Jonas Bernoulli 35@author Jonas Bernoulli
36@page 36@page
37@vskip 0pt plus 1filll 37@vskip 0pt plus 1filll
@@ -53,7 +53,7 @@ resource to get over that hurdle is Psionic K's interactive tutorial,
53available at @uref{https://github.com/positron-solutions/transient-showcase}. 53available at @uref{https://github.com/positron-solutions/transient-showcase}.
54 54
55@noindent 55@noindent
56This manual is for Transient version 0.8.3. 56This manual is for Transient version 0.8.4.
57 57
58@insertcopying 58@insertcopying
59@end ifnottex 59@end ifnottex
@@ -93,6 +93,7 @@ Defining New Commands
93* Binding Suffix and Infix Commands:: 93* Binding Suffix and Infix Commands::
94* Defining Suffix and Infix Commands:: 94* Defining Suffix and Infix Commands::
95* Using Infix Arguments:: 95* Using Infix Arguments::
96* Using Prefix Scope::
96* Current Suffix Command:: 97* Current Suffix Command::
97* Current Prefix Command:: 98* Current Prefix Command::
98* Transient State:: 99* Transient State::
@@ -553,6 +554,48 @@ the level specified by @code{transient-default-level} are temporarily
553available anyway. 554available anyway.
554@end table 555@end table
555 556
557@defun transient-set-default-level suffix level
558This function sets the default level of the suffix COMMAND to LEVEL@.
559
560If a suffix command appears in multiple menus, it may make sense to
561consistently change its level in all those menus at once. For
562example, the @code{--gpg-sign} argument (which is implemented using the
563command @code{magit:--gpg-sign}), is bound in all of Magit's menu which
564create commits. Users who sometimes sign their commits would want
565that argument to be available in all of these menus, while for users
566who never sign it is just unnecessary noise in any menus.
567
568To always make @code{--gpg-sign} available, use:
569
570@lisp
571(transient-set-default-level 'magit:--gpg-sign 1)
572@end lisp
573
574To never make @code{--gpg-sign} available, use:
575
576@lisp
577(transient-set-default-level 'magit:--gpg-sign 0)
578@end lisp
579
580This sets the level in the suffix prototype object for this command.
581Commands only have a suffix prototype if they were defined using one
582of @code{transient-define-argument}, @code{transient-define-infix} and
583@code{transient-define-suffix}. For all other commands this would signal
584an error. (This is one of the reasons why package authors should
585use one of these functions to define shared suffix commands, and
586especially shared arguments.)
587
588If the user changes the level of a suffix in a particular menu,
589using @kbd{C-x l} as shown above, then that obviously shadows the default.
590
591It is also possible to set the level of a suffix binding in a
592particular menu, either when defining the menu using
593@code{transient-define-prefix,} or later using @code{transient-insert-suffix}. If
594such bindings specify a level, then that also overrides the default.
595(Per-suffix default levels is a new feature, so you might encounter
596this quite often.)
597@end defun
598
556@node Other Commands 599@node Other Commands
557@section Other Commands 600@section Other Commands
558 601
@@ -1017,6 +1060,7 @@ signal an error.
1017* Binding Suffix and Infix Commands:: 1060* Binding Suffix and Infix Commands::
1018* Defining Suffix and Infix Commands:: 1061* Defining Suffix and Infix Commands::
1019* Using Infix Arguments:: 1062* Using Infix Arguments::
1063* Using Prefix Scope::
1020* Current Suffix Command:: 1064* Current Suffix Command::
1021* Current Prefix Command:: 1065* Current Prefix Command::
1022* Transient State:: 1066* Transient State::
@@ -1323,6 +1367,13 @@ be replaced with an error.
1323The boolean @code{:pad-keys} argument controls whether keys of all suffixes 1367The boolean @code{:pad-keys} argument controls whether keys of all suffixes
1324contained in a group are right padded, effectively aligning the 1368contained in a group are right padded, effectively aligning the
1325descriptions. 1369descriptions.
1370
1371@item
1372If a keyword argument accepts a function as value, you an use a
1373@code{lambda} expression. As a special case, the @code{##} macro (which returns a
1374@code{lambda} expression and is implemented in the @code{llama} package) is also
1375supported. Inside group specifications, the use of @code{##} is not
1376supported anywhere but directly following a keyword symbol.
1326@end itemize 1377@end itemize
1327 1378
1328The @var{ELEMENT}s are either all subgroups, or all suffixes and strings. 1379The @var{ELEMENT}s are either all subgroups, or all suffixes and strings.
@@ -1446,6 +1497,12 @@ Finally, details can be specified using optional @var{KEYWORD}-@var{VALUE} pairs
1446Each keyword has to be a keyword symbol, either @code{:class} or a keyword 1497Each keyword has to be a keyword symbol, either @code{:class} or a keyword
1447argument supported by the constructor of that class. @xref{Suffix Slots}. 1498argument supported by the constructor of that class. @xref{Suffix Slots}.
1448 1499
1500If a keyword argument accepts a function as value, you an use a @code{lambda}
1501expression. As a special case, the @code{##} macro (which returns a @code{lambda}
1502expression and is implemented in the @code{llama} package) is also supported.
1503Inside suffix bindings, the use of @code{##} is not supported anywhere but
1504directly following a keyword symbol.
1505
1449@node Defining Suffix and Infix Commands 1506@node Defining Suffix and Infix Commands
1450@section Defining Suffix and Infix Commands 1507@section Defining Suffix and Infix Commands
1451 1508
@@ -1568,6 +1625,55 @@ used if you need the objects (as opposed to just their values) and
1568if the current command is not being invoked from @var{PREFIX}. 1625if the current command is not being invoked from @var{PREFIX}.
1569@end defun 1626@end defun
1570 1627
1628@node Using Prefix Scope
1629@section Using Prefix Scope
1630
1631Some transients have a sort of secondary value, called a scope. A
1632prefix's scope can be accessed using @code{transient-scope}; similar to how
1633its value can be accessed using @code{transient-args}.
1634
1635@defun transient-scope prefixes classes
1636This function returns the scope of the active or current transient
1637prefix command.
1638
1639If optional PREFIXES and CLASSES are both nil, return the scope of
1640the prefix currently being setup, making this variation useful, e.g.,
1641in @code{:if*} predicates. If no prefix is being setup, but the current
1642command was invoked from some prefix, then return the scope of that.
1643
1644If PREFIXES is non-nil, it must be a prefix command or a list of such
1645commands. If CLASSES is non-nil, it must be a prefix class or a list
1646of such classes. When this function is called from the body or the
1647@code{interactive} form of a suffix command, PREFIXES and/or CLASSES should
1648be non-nil. If either is non-nil, try the following in order:
1649
1650@itemize
1651@item
1652If the current suffix command was invoked from a prefix, which
1653appears in PREFIXES, return the scope of that prefix.
1654
1655@item
1656If the current suffix command was invoked from a prefix, and its
1657class derives from one of the CLASSES, return the scope of that
1658prefix.
1659
1660@item
1661If a prefix is being setup and it appears in PREFIXES, return its
1662scope.
1663
1664@item
1665If a prefix is being setup and its class derives from one of the
1666CLASSES, return its scope.
1667
1668@item
1669Finally try to return the default scope of the first command in
1670PREFIXES@. This only works if that slot is set in the respective
1671class definition or using its `transient-init-scope' method.
1672@end itemize
1673
1674If no prefix matches, return nil.
1675@end defun
1676
1571@node Current Suffix Command 1677@node Current Suffix Command
1572@section Current Suffix Command 1678@section Current Suffix Command
1573 1679
@@ -2458,8 +2564,9 @@ being initialized. This slot is still experimental.
2458@code{transient-mode-line-format}. It should have the same type. 2564@code{transient-mode-line-format}. It should have the same type.
2459 2565
2460@item 2566@item
2461@code{column-width} is only respected inside @code{transient-columns} groups and 2567@code{column-widths} is only respected inside @code{transient-columns} groups and
2462allows aligning columns across separate instances of that. 2568allows aligning columns across separate instances of that. A list
2569of integers.
2463 2570
2464@item 2571@item
2465@code{variable-pitch} controls whether alignment is done pixel-wise to 2572@code{variable-pitch} controls whether alignment is done pixel-wise to
@@ -2535,8 +2642,9 @@ Also see @ref{Suffix Classes}.
2535@subheading Slots of @code{transient-child} 2642@subheading Slots of @code{transient-child}
2536 2643
2537This is the abstract superclass of @code{transient-suffix} and @code{transient-group}. 2644This is the abstract superclass of @code{transient-suffix} and @code{transient-group}.
2538This is where the shared @code{if*} and @code{inapt-if*} slots (see @ref{Predicate Slots}) 2645This is where the shared @code{if*} and @code{inapt-if*} slots (see @ref{Predicate Slots}),
2539and the @code{level} slot (see @ref{Enabling and Disabling Suffixes}) are defined. 2646the @code{level} slot (see @ref{Enabling and Disabling Suffixes}), and the @code{advice}
2647and @code{advice*} slots (see @ref{Slots of @code{transient-suffix}}) are defined.
2540 2648
2541@itemize 2649@itemize
2542@item 2650@item
@@ -2595,6 +2703,24 @@ for details.
2595defining a command using @code{transient-define-suffix}. 2703defining a command using @code{transient-define-suffix}.
2596@end itemize 2704@end itemize
2597 2705
2706The following two slots are experimental. They can also be set for a
2707group, in which case they apply to all suffixes in that group, except
2708for suffixes that set the same slot to a non-nil value.
2709
2710@itemize
2711@item
2712@code{advice} A function used to advise the command. The advise is called
2713using @code{(apply advice command args)}, i.e., it behaves like an "around"
2714advice.
2715
2716@item
2717@code{advice*} A function used to advise the command. Unlike @code{advice}, this
2718advises not only the command body but also its @code{interactive} spec. If
2719both slots are non-nil, @code{advice} is used for the body and @code{advice*} is
2720used for the @code{interactive} form. When advising the @code{interactive} spec,
2721called using @code{(funcall advice #'advice-eval-interactive-spec spec)}.
2722@end itemize
2723
2598@anchor{Slots of @code{transient-infix}} 2724@anchor{Slots of @code{transient-infix}}
2599@subheading Slots of @code{transient-infix} 2725@subheading Slots of @code{transient-infix}
2600 2726