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 =
.
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:
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)])
To my knowledge, Hydra does not support that.
Both packages make it possible to specify how exactly the available commands are outlined:
The downside of this is that it becomes harder for a user to add additional commands to an existing hydra and to change key bindings.
However while Transient supports giving sections a heading it does not currently support giving the displayed information more structure by, for example, using box-drawing characters.
That could be implemented by defining a new group class, which lets the author specify a format string. It should be possible to implement that without modifying any existing code, but it does not currently exist.