7.2 Comparison With Other Packages

7.2.1 Magit-Popup

Transient is the successor to Magit-Popup (see (magit-popup)Top).

One major difference between these two implementations of the same ideas is that while Transient uses transient keymaps and embraces the command-loop, Magit-Popup implemented an inferior mechanism that does not use transient keymaps and that instead of using the command-loop implements a naive alternative based on read-char .

Magit-Popup does not use classes and generic functions and defining a new command type is near impossible as it involves adding hard-coded special-cases to many functions. Because of that only a single new type was added, which was not already part of Magit-Popup’s initial release.

A lot of things are hard-coded in Magit-Popup. One random example is that the key bindings for switches must begin with "-" and those for options must begin with "=".

7.2.2 Hydra

Hydra (see https://github.com/abo-abo/hydra) is another package that provides features similar to those of Transient.

Both packages use transient keymaps to make a set of commands temporarily available and show the available commands in a popup buffer.

A Hydra "body" is equivalent to a Transient "prefix" and a Hydra "head" is equivalent to a Transient "suffix". Hydra has no equivalent of a Transient "infix".

Both hydras and transients can be used as simple command dispatchers. Used like this they are similar to regular prefix commands and prefix keys, except that the available commands are shown in the popup buffer.

(Another package that does this is which-key . It does so automatically for any incomplete key sequence. The advantage of that approach is that no additional work is necessary; the disadvantage is that the available commands are not organized semantically.)

Both Hydra and Transient provide features that go beyond simple command dispatchers:

Invoking a command from a hydra does not necessarily exit the hydra. That makes it possible to invoke the same command again, but using a shorter key sequence (i.e. the key that was used to enter the hydra does not have to be pressed again). Transient supports that too, but for now this feature is not a focus and the interface is a bit more complicated. A very basic example using the current interface: (transient-define-prefix outline-navigate () :transient-suffix 'transient--do-stay :transient-non-suffix 'transient--do-warn [("p" "previous visible heading" outline-previous-visible-heading) ("n" "next visible heading" outline-next-visible-heading)])

Transient supports infix arguments; values that are set by infix commands and then consumed by the invoked suffix command(s). To my knowledge, Hydra does not support that.

Both packages make it possible to specify how exactly the available commands are outlined: