GNU-devel ELPA - transient

transient Atom Feed

Description
Transient commands
Latest
transient-0.8.1.0.20241208.222738.tar (.sig), 2024-Dec-09, 600 KiB
Maintainer
Jonas Bernoulli <emacs.transient@jonas.bernoulli.dev>
Website
https://github.com/magit/transient
Browse ELPA's repository
CGit or Gitweb
Badge
Manual
transient

To install this package from Emacs, use package-install or list-packages.

Full description

1. Transient command menus

Transient is the library used to implement the keyboard-driven “menus” in Magit. It is distributed as a separate package, so that it can be used to implement similar menus in other packages.

1.1. Some things that Transient can do

  • Display current state of arguments
  • Display and manage lifecycle of modal bindings
  • Contextual user interface
  • Flow control for wizard-like composition of interactive forms
  • History & persistence
  • Rendering arguments for controlling CLI programs

1.2. Complexity in CLI programs

Complexity tends to grow with time. How do you manage the complexity of commands? Consider the humble shell command ls. It now has over fifty command line options. Some of these are boolean flags (ls -l). Some take arguments (ls --sort=s). Some have no effect unless paired with other flags (ls -lh). Some are mutually exclusive. Some shell commands even have so many options that they introduce subcommands (git branch, git commit), each with their own rich set of options (git branch -f).

1.3. Using Transient for composing interactive commands

What about Emacs commands used interactively? How do these handle options? One solution is to make many versions of the same command, so you don't need to! Consider: delete-other-windows vs. delete-other-windows-vertically (among many similar examples).

Some Emacs commands will simply prompt you for the next "argument" (M-x switch-to-buffer). Another common solution is to use prefix arguments which usually start with C-u. Sometimes these are sensibly numerical in nature (C-u 4 M-x forward-paragraph to move forward 4 paragraphs). But sometimes they function instead as boolean "switches" (C-u C-SPACE to jump to the last mark instead of just setting it, C-u C-u C-SPACE to unconditionally set the mark). Since there aren't many standards for the use of prefix options, you have to read the command's documentation to find out what the possibilities are.

But when an Emacs command grows to have a truly large set of options and arguments, with dependencies between them, lots of option values, etc., these simple approaches just don't scale. Transient is designed to solve this issue. Think of it as the humble prefix argument C-u, raised to the power of 10. Like C-u, it is key driven. Like the shell, it supports boolean "flag" options, options that take arguments, and even "sub-commands", with their own options. But instead of searching through a man page or command documentation, well-designed transients guide their users to the relevant set of options (and even their possible values!) directly, taking into account any important pre-existing Emacs settings. And while for shell commands like ls, there is only one way to "execute" (hit Return!), transients can "execute" using multiple different keys tied to one of many self-documenting actions (imagine having 5 different colored return keys on your keyboard!). Transients make navigating and setting large, complex groups of command options and arguments easy. Fun even. Once you've tried it, it's hard to go back to the C-u what can I do here again? way.

transient.png



Compile Manual GNU ELPA MELPA Stable MELPA

Old versions

transient-0.8.0.0.20241206.220403.tar.lz2024-Dec-07 101 KiB
transient-0.7.9.0.20241203.214158.tar.lz2024-Dec-0499.3 KiB
transient-0.7.9.0.20241202.211122.tar.lz2024-Dec-0399.3 KiB
transient-0.7.9.0.20241120.93248.tar.lz2024-Nov-2096.9 KiB
transient-0.7.8.0.20241104.122222.tar.lz2024-Nov-0496.4 KiB
transient-0.7.4.0.20240830.181745.tar.lz2024-Aug-3194.4 KiB
transient-0.6.0.0.20240609.202011.tar.lz2024-Jun-1492.7 KiB
transient-0.5.3.0.20240311.163849.tar.lz2024-Mar-1191.1 KiB
transient-0.4.3.0.20231127.163229.tar.lz2023-Nov-2786.5 KiB
transient-0.0.20201221.170234.tar.lz2020-Dec-2167.2 KiB

News

# -*- mode: org -*-
* v0.8.1    2024-12-08

Bug fixes:

- Interactively setting the level of a transient prefix resulted in
  an error.  #337.

* v0.8.0    2024-12-06

- While the minibuffer is in use, the menu window is now hidden by
  default.  The new option ~transient-show-during-minibuffer-read~ not
  only controls whether the menu stays visible while the minibuffer
  is in use, but also whether it may be resized if necessary.  This
  new option replaces ~transient-hide-during-minibuffer-read~.  #330

- When returning to a prefix whose ~refresh-suffixes~ slot is non-nil,
  its suffixes are now re-initialized.  #327

- Added documentation for ~inapt-if*~ slots to manual.  179545a6

- ~transient-args~ and ~transient-scope~ now both take a prefix command or
  a list of prefix commands as argument.  ~transient-scope~ can still be
  called without an argument, but that should only be done in functions
  that take part in setting up a menu, not in a suffix command.

- Added new generic function ~transient-prefix-value~, giving finer
  control over how the value returned by ~transient-args~ is determined.

- Added support for implementing ~transient-init-scope~ methods for
  prefix classes.

- ~transient-setup-buffer-hook~ is now run later to allow overriding
  more default settings.

- The new prefix slots ~display-action~ and ~mode-line-format~, can be
  used to override ~transient-display-buffer-action~ and
  ~transient-mode-line-format~ for individual prefix menus.  #332

- Updated the manual considerably.

Bug fixes:

- Fixes some menu navigation edge-cases.

* v0.7.9    2024-11-04

Bug fixes:

- Fixed a recent regression in ~transient-suffix-object~.  #325

- The height of the transient window was fixed even it used the full
  frame height.  5478d4e6

* v0.7.8    2024-11-02

- Additional potential mistakes in menu definitions are now detected.
  bbda5bb6, 8873c300

- Added new (and still experimental) ~environment~ prefix slot, which
  can be used to, for example, implement a cache to be used while
  refreshing the menu.  05c011b8

- When navigating through the menu using the keyboard or hovering a
  suffix command with the mouse, information about the command is now
  shown in the echo area or using a tooltip.  #282

Bug fixes:

- When the command that exits a transient uses the minibuffer,
  ~transient-current-*~ variables were not immediately reset to
  ~nil~. #323

- Key sequences with three or more events broke
  ~transient-suffix-object~.  #324

* v0.7.7    2024-10-04

Bug fix:

- Fix a regression introduced by the previous commit, which broke
  dynamic prefixes that use a ~:setup-children~ function to prepare
  their suffixes.  #313

* v0.7.6    2024-10-01

- ~transient-active-prefix~ now accepts a single prefix symbol, in place
  of a list of such symbols.  #307

- ~other-frame-prefix~ and ~other-window-prefix~ can now be used while a
  transient prefix is active.  #305

- Added new macro ~transient-with-help-window~ for use in ~:show-help~
  functions.  #309

* v0.7.5    2024-09-01

- Updated tooling.

Bug fixes:

- ~static-if~ is now used correctly.  0e35673e

- When an existing window ends up being used to display the transient
  buffer, then the previous value of the ~no-other-window~ parameter is
  now restored, when the transient is exited.  #302

- The names assigned to suffixes, which are defined using lambdas in
  the prefix definition, are now guaranteed to be unique.  #304

* v0.7.4    2024-08-05

- Added new function ~transient-active-prefix~.

* v0.7.3    2024-07-13

- Refactored code responsible for inserting columns.

Bug fix:

- The ~transient-current-*~ variables are intended to only be used by
  suffix commands, when they are invoked from a prefix.  Previously
  they were only cleared when the prefix is ultimately exited, which
  meant that they unintentionally were accessible in timers.  Now the
  values of these variables are nil when used outside their intended
  scope.  0e0ece32, f2cb28a5

* v0.7.2    2024-06-24
...
...