Suffix Classes
All suffix and infix classes derive from
transient-suffix, which in turn derives fromtransient-child, from whichtransient-groupalso derives (see Group Classes).All infix classes derive from the abstract
transient-infixclass, which in turn derives from thetransient-suffixclass.Infixes are a special type of suffixes. The primary difference is that infixes always use the
transient--do-staypre-command, while non-infix suffixes use a variety of pre-commands (see Transient State). Doing that is most easily achieved by using this class, though theoretically it would be possible to define an infix class that does not do so. If you do that then you get to implement many methods.Also, infixes and non-infix suffixes are usually defined using different macros (see Defining Suffix and Infix Commands).
Classes used for infix commands that represent arguments should be derived from the abstract
transient-argumentclass.The
transient-switchclass (or a derived class) is used for infix arguments that represent command-line switches (arguments that do not take a value).The
transient-optionclass (or a derived class) is used for infix arguments that represent command-line options (arguments that do take a value).The
transient-switchesclass can be used for a set of mutually exclusive command-line switches.The
transient-filesclass can be used for a ‘--’ argument that indicates that all remaining arguments are files.Classes used for infix commands that represent variables should derived from the abstract
transient-variableclass.The
transient-informationandtransient-information*classes are special in that suffixes that use these class are not associated with a command and thus also not with any key binding. Such suffixes are only used to display arbitrary information, and that anywhere a suffix can appear. Display-only suffix specifications take these form:emacs-lisp(:info DESCRIPTION [KEYWORD VALUE]...) (:info* DESCRIPTION [KEYWORD VALUE]...)The
:infoand:info*keyword arguments replaces the:descriptionkeyword used for other suffix classes. Other keyword arguments that you might want to set, include:face, predicate keywords (such as:ifand:inapt-if), and:format. By default the value of:formatincludes%k, which for this class is replaced with the empty string or spaces, if keys are being padded in the containing group.The only difference between these two classes is that
:info*aligns its description with the descriptions of suffix commands, while for:infothe description bleeds into the area where suffixes display their key bindings.The
transient-lisp-variableclass can be used to show and change the value of lisp variables. This class is not fully featured yet and it is somewhat likely that future improvements won’t be fully backward compatible.The
transient-cons-optionclass is intended for situations wheretransient-argsshould return an alist, instead of a list of strings (arguments). Such suffixes can be specified in prefix definitions like so:emacs-lisp(:cons OPTION :key KEY [KEYWORD VALUE]...)OPTION may be something other than a string, likely a keyword or some other symbol, it is used as the
carof the cons-cell. When using such an inline definition:keyhas to be specified. In most cases:readershould also be specified. When defining such a suffix separately, the "alist key" has to be specified using the:variablekeyword argument.This class is still experimental it is somewhat likely that future improvements won’t be fully backward compatible.
The
transient-describe-targetclass is used by the commandtransient-describe.The
transient-value-presetclass is used to implement the commandtransient-preset, which activates a value preset.
Magit defines additional classes, which can serve as examples for the fancy things you can do without modifying Transient. Some of these classes will likely get generalized and added to Transient. For now they are very much subject to change and not documented.