5.6 Suffix Methods

To get information about the methods implementing these generic functions use describe-function.

5.6.1 Suffix Value Methods

Function: transient-init-value obj

This generic function sets the initial value of the object OBJ. Methods exist for both prefix and suffix objects.

For transient-argument objects this function handles setting the value by itself.

For other transient-suffix objects (including transient-infix objects), this calls transient-default-value and uses the value returned by that, unless it is the special value eieio--unbound, which indicates that there is no default value. Since that is what the default method for transient-suffix objects does, both of these functions effectively are noops for these classes.

If you implement a class that derives from transient-infix directly, then you must implement a dedicated method for this function and/or transient-default-value.

Function: transient-default-value obj

This generic function returns the default value of the object OBJ. Methods exist for both prefix and suffix objects.

Function: transient-infix-read obj

This generic function determines the new value of the infix object OBJ.

This function merely determines the value; transient-infix-set is used to actually store the new value in the object.

For most infix classes this is done by reading a value from the user using the reader specified by the reader slot (using the transient-infix-value method described below).

For some infix classes the value is changed without reading anything in the minibuffer, i.e., the mere act of invoking the infix command determines what the new value should be, based on the previous value.

Function: transient-prompt obj

This generic function returns the prompt to be used to read infix object OBJ’s value.

Function: transient-infix-set obj value

This generic function sets the value of infix object OBJ to VALUE.

Function: transient-infix-value obj

This generic function returns the value of the suffix object OBJ.

This function is called by transient-args (which see), meaning this function is how the value of a transient is determined so that the invoked suffix command can use it.

Currently most values are strings, but that is not set in stone. nil is not a value, it means “no value”.

Usually only infixes have a value, but see the method for transient-suffix.

Function: transient-init-scope obj

This generic function sets the scope of the object OBJ. Methods exist for both prefix and suffix objects.

The scope is actually a property of the transient prefix, not of individual suffixes. However it is possible to invoke a suffix command directly instead of from a transient. In that case, if the suffix expects a scope, then it has to determine that itself and store it in its scope slot.

This function is called for all prefix and suffix commands, but unless a concrete method is implemented, this falls through to the default implementation, which is a noop.

5.6.2 Suffix Format Methods

Function: transient-format obj

This generic function formats and returns OBJ for display.

When this function is called, then the current buffer is some temporary buffer. If you need the buffer from which the prefix command was invoked to be current, then do so by temporarily making transient--source-buffer current.

Function: transient-format-key obj

This generic function formats OBJ’s key for display and returns the result.

Function: transient-format-description obj

This generic function formats OBJ’s description for display and returns the result.

Function: transient-format-value obj

This generic function formats OBJ’s value for display and returns the result.

Function: transient-show-help obj

Show help for the prefix, infix or suffix command represented by OBJ.

Regardless of OBJ’s type, if its show-help slot is non-nil, that must be a function, which takes OBJ is its only argument. It must prepare, display and return a buffer, and select the window used to display it. The transient-show-help-window macro is intended for use in such functions.

For prefixes, show the info manual, if that is specified using the info-manual slot. Otherwise, show the manpage if that is specified using the man-page slot. Otherwise, show the command’s documentation string.

For suffixes, show the command’s documentation string.

For infixes, show the manpage if that is specified. Otherwise show the command’s documentation string.

Macro: transient-with-help-window &rest body

Evaluate BODY, send output to *Help* buffer, and display it in a window. Select the help window, and make the help buffer current and return it.

Function: transient-show-summary obj &optional return

This generic function shows or, if optional RETURN is non-nil, returns a brief summary about the command at point or hovered with the mouse.

This function is called when the mouse is moved over a command and (if the value of transient-enable-popup-navigation is verbose) when the user navigates to a command using the keyboard.

If OBJ’s summary slot is a string, that is used. If summary is a function, that is called with OBJ as the only argument and the returned string is used. If summary is or returns something other than a string or nil, no summary is shown. If summary is or returns nil, the first line of the documentation string is used, if any.

If RETURN is non-nil, this function returns the summary instead of showing it. This is used when a tooltip is needed.