5.5 Prefix Methods

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

Function: transient-init-value obj

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

The default method for prefix objects sets the value of OBJ’s value slot to the set, saved or default value. The value that is set for the current session is preferred over the saved value, which is preferred over the default value.

The default value is determined using the generic function transient-default-value. If you need to change how the value for a prefix class is determined, its usually sufficient to implement a method for that function.

Function: transient-default-value obj

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

The default method for prefix objects returns the value of the default-value slot if that is bound and not a function. If it is a function, that is called to get the value. If the slot is unbound, nil is returned.

Function: transient-prefix-value obj

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

OBJ is a prototype object and is only used to select the appropriate method of this generic function. This function does not return the value of that object. Instead it extracts the name of the respective command from the object and uses that to collect the current values from the suffixes of the prefix from which the current command was invoked. If the current command was not invoked from the identified prefix, then this method returns the set, save or default value, as described for transient-args.

This function is only intended to be used by transient-args. It is not defined as an internal function because third-party packages may define their own methods. That does not mean that it would be a good idea to call it for any other purpose.

The respective generic function for infix and suffix objects is named transient-infix-value.

Function: transient-init-scope obj

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

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.

transient-set-value, transient-save-value, transient-reset-value, transient--history-key, transient--history-push and transient--history-init are other generic functions dealing with the value of prefix objects. See their doc-strings for more information.

transient-show-help is another generic function implemented for prefix commands. The default method effectively describes the command using describe-function.