summaryrefslogtreecommitdiff
path: root/lisp
AgeCommit message (Collapse)Author
2026-04-22Release version 0.13.0HEADv0.13.0mainJonas Bernoulli
2026-04-22Add kludge for mystery issue involving static-if and defaliasJonas Bernoulli
It appears that for some users `static-if' expands to nothing if the THEN or ELSE part is a `defalias' form (whichever is used in their case). I got similar reports when using `static-if' more than once, last in https://github.com/magit/magit/issues/5557, and while I was never able to reproduce, I concluded that these report are credible.
2026-04-15Restore compatibility with emoji.el from Emacs 29.4Jonas Bernoulli
Closes #417
2026-04-14Remove internal--build-binding backportJonas Bernoulli
The built-in `if-let' et al. implementations are no longer used.
2026-04-13Use string-pixel-width if definedJonas Bernoulli
2026-04-13transient--string-pixel-width: Renamed functionJonas Bernoulli
Shortly after this was added to Transient, `string-pixel-width' was added to Emacs. Also rearrange a bit to use same nesting as was originally used in that function.
2026-04-01transient--delete-window: Recover from more window misconfigurationsJonas Bernoulli
Make sure transient state is exited properly (except that the window may remain visible of course). We already demoted such errors, in one place in this function, where we expected such misconfigurations could cause an error, but the problem may not show up until these later steps, so wrap those too. Re #429.
2026-04-01transient-describe: Fix docstring typoJonas Bernoulli
2026-03-31Use Cond-Let's and-let moreJonas Bernoulli
2026-03-27transient--advise-this-command: New functionJonas Bernoulli
Removing the duplication gives us a place and some space to add documentation.
2026-03-27transient-suffix-object: Peal advice for primitive commandsJonas Bernoulli
For comparison we need `this-command' to be a symbol, but when that is a primitive or anonymous function, then `transient--wrap-command' adds an advice to `this-command', which we have to peal off here.
2026-03-27transient--wrap-command: Fix advising of native-compiled LispJonas Bernoulli
Unlike its docstring, the info manual is outdated and falsely claims that `subrp' only returns t for built-in functions, but it also does so for native-compiled Lisp functions. Having looked only at the info manual, I ended up using `subrp' in the previous commit, [1: 63f90723], to test whether the command is a "built-in function". What I was looking for is now called a primitive and the respective predicate is called `subr-primitive-p'. Closes #435.
2026-03-24transient--wrap-command: Advise built-in commands via this-commandJonas Bernoulli
The advise is ineffective otherwise, as can be observed using (transient-define-prefix demo () [("g" "goto" goto-char :transient t)])
2026-03-23Revert "Use single-arg form of signal to re-throw starting with Emacs 30"Jonas Bernoulli
Turns out `signal' does not accept a single argument in Emacs 30. This reverts commit 61ed3651df360e1a0c36ff70afbb9ee0f947252a.
2026-03-22Use single-arg form of signal to re-throw starting with Emacs 30Jonas Bernoulli
Stefan informed me that this is supported since at least that version.
2026-03-21Use single-arg form of signal to re-throw an errorJonas Bernoulli
Emacs 31.0.t0 supports this since [1: a1358530f53], which also adds `error-type-p'. So we check whether that exists to determine which form we can use. 1: 2026-03-10 a1358530f533a1151c7207e1ad634b1b9fae5a91 Improve the error API
2026-03-21transient-infix-read: Avoid turning nil into "" if multi-value is non-nilJonas Bernoulli
If STRINGS is nil, `string-join' returns the empty string, not nil. Closes #434.
2026-03-17transient-init-value: Handle multiline valuesZoey Hewll
Allow `transient-init-value' to respect multiline string values, rather than truncating them to the first line. As a regex pattern, ".*" does not match multiline strings because the "." pattern matches any character besides a line terminator. Emacs regex syntax uses the "[^z-a]" pattern to match any character including line terminators. This distinction is represented by `(rx (* nonl))' vs`(rx (* anychar))' in the `rx' macro syntax, and the expression implemented here is as produced by `(rx string-start (literal "%s") (group (* anychar)) string-end)'. Fixes #432
2026-03-10transient--suffixes: No longer populate by side-effectJonas Bernoulli
This is cleaner but less efficient than the previous approach. We now have to flatten the tree of suffixes when initially displaying the menu. Previously we only had to do so when refreshing the menu. If flattening is fast enough when refreshing, then it should to be fast enough for initial display as well.
2026-03-10transient--suffixes: Safely populate by side-effectJonas Bernoulli
`transient--suffixes' is populated by side-effect. `transient--init-suffix' pushes elements onto that list. `transient--init-suffix' is called indirectly via `transient--init-suffixes'. `transient--init-objects', one of the two callers of the latter dealt with this properly, but the other, `transient-suffixes' did not. The latter is called indirectly by `transient-args', which happens when no prefix is active and `transient--suffixes' should therefore remain nil. In most cases it did not matter that it ended up non-nil anyway, but it broke `transient-suffix-object', which ended up preferring the invalid non-nil value of `transient--suffixes' in situations where it should have fallen back to `transient-current-suffixes'. This caused https://github.com/magit/magit/issues/5528. Fix containing the side-effect within `transient--init-suffixes'. The value is still created incrementally by side-effect, but that value is captured in `transient--init-suffixes' and added to its return value. Callers can then either use the returned value to set the global value of `transient--suffixes', or discard it.
2026-03-10transient--describe-function: Handle describe-function overridesPablo Stafforini
`transient--describe-function' captures the help buffer via `temp-buffer-window-setup-hook'. This works with the built-in `describe-function', which displays its output via `with-help-window' and therefore triggers the hook. However, a common pattern in the Emacs community is to override `describe-function' with a function provided by a packages like `helpful'. `helpful-function' creates and displays its buffer via `pop-to-buffer' rather than `with-help-window', so `temp-buffer-window-setup-hook' never fires and `buffer' stays nil, causing (set-buffer nil) to signal `wrong-type-argument'. See #431.
2026-03-05transient--quit-kludge: Add commentJonas Bernoulli
2026-03-05transient--display-action: Tweak a commentJonas Bernoulli
For consistency with similar comments elsewhere in this library.
2026-03-05transient-read-string-from-buffer: New functionJonas Bernoulli
2026-03-05transient--recursive-edit: Actually handle aborts as intendedJonas Bernoulli
For context, read the docstring of `recursive-edit'. In our case it is most suitable if the recursive edit is exited using the "any other value" variant, but that isn't guaranteed, so we have to handle the other exit variants as well. Wrap the call to `recursive-edit' with `unwind-protect' to ensure we regain control, when `recursive-edit' returns to the command loop one level up (i.e., our level). We use this to either completely exit or completely restore the menu. If (throw 'exit t) is used to abort the recursive edit, then we also exit the menu. (This is a design decision.) We can only detect this if it was done by invoking `abort-recursive-edit' as a command. If this form was evaluated through other means, we end up restoring the menu. However this also causes "C-g" to be immediately unread, which results in `transient-quit-one' being invoked, so the menu is exited anyway. Needlessly restoring the menu first is unfortunate, but not a big deal (users won't notice). Additionally wrap the `unwind-protect' with `condition-case'. This is needed to deal with the (throw 'exit "'error' message") variant. This variant is commonly used to print an abort message, which isn't really an error as far as we are concerned. We want to demote "abort errors" to messages. Unfortunately "abort errors" do not use a dedicated error type (see `recursive_edit_1'), and `condition-case' can only match against error types (symbols), meaning that it cannot distinguish an abort from a genuine error. As a consequence we are stuck demoting both abort messages and genuine error messages. Closes #425. Closes #426.
2026-03-05transient-infix-read: Use current value as initial inputJonas Bernoulli
Usually the infix is unset if invoked while it has value. It then has to be invoked a second time to set another value. During that second value the previous value is used as initial-input because it was previously added to the history and we already explicitly use that here. However when `always-read' is non-nil, the infix isn't toggled off like this and we have to pass along the current value as initial- input on the first and only invocation.
2026-03-03transient-use-accessible-values: New optionJonas Bernoulli
2026-03-03transient-{argument,value}-face: New functionsJonas Bernoulli
2026-03-03transient-use-accessible-formats: New optionJonas Bernoulli
2026-03-03transient-prefer-reading-value: New optionJonas Bernoulli
2026-03-03manual: Use term visually impaired where appropriateJonas Bernoulli
2026-02-28Revert "Use functions as format-spec substitutions when supported"Jonas Bernoulli
This reverts commit 77e8aa64e800327b523f0eb675223f63dce62fe5. `format-spec' makes a temporary buffer current for internal purposes. Sadly does not undo that, while evaluating the substitution functions. Our substitution functions expect to be called in the buffer, which was current before this function is called.
2026-02-26Document contact options in library commentaryJonas Bernoulli
I used to believe that it was enough that the library header contains ;; Author: Jonas Bernoulli <emacs.transient@jonas.bernoulli.dev> ;; Homepage: https://github.com/magit/transient and https://elpa.gnu.org/packages/transient.html contains Maintainer Jonas Bernoulli <emacs.transient@jonas.bernoulli.dev> Website https://github.com/magit/transient and the output of M-x describe-package RET transient RET contains Website: https://github.com/magit/transient Maintainer: Jonas Bernoulli <emacs.transient@jonas.bernoulli.dev> Author: Jonas Bernoulli <emacs.transient@jonas.bernoulli.dev> to imply that either one or the other can be used to contact me, the maintainer, about Transient; but the consensus on emacs-devel seems to be that this information has to be spelled out in the library commentary, so that's what I do now. (Also note that the email address contains the substring "transient", which implies that it is intended for inquiries about Transient.)
2026-02-23transient-information: No longer double down on format initformJonas Bernoulli
It is the same as for the parent class.
2026-02-23Use functions as format-spec substitutions when supportedJonas Bernoulli
2026-02-23transient-get-summary: Optionally echo even duplicated documentationJonas Bernoulli
2026-02-23transient-get-summary: CosmeticsJonas Bernoulli
2026-02-23transient-get-summary: Support all object typesJonas Bernoulli
Remove the stub implementations and instead teach the method previously only used for most `transient-suffix' to also support `transient-prefix', `transient-group' and all subclasses of `transient-suffix'.
2026-02-23transient-object: New base classJonas Bernoulli
2026-02-23manual: Improve Accessibility Options nodeJonas Bernoulli
2026-02-23manual: Reorder Accessibility Options nodeJonas Bernoulli
2026-02-08Set new autoload-macro property for some macrosStefan Monnier
This feature was added in Emacs commit [1: 7486e5c3680] using it here allows removing these macros from `loaddefs--defining-macros'. Besides the three macros for which we now set that property, `transient-define-group' was listed in that variable, since [2: 105ae06031a], but it appears that was not actually needed. Use `put' instead of `declare', to avoid warnings on Emacs < 31. 1: 2025-08-10 7486e5c3680b41cb58cb6eb1fa5aa3620d4a50bd Implement new autoload macro expansion declare form 2: 2025-07-15 105ae06031a548e1afd7b7a992c1da783f498534 Allow trivially autoloading transient-define-group
2026-01-30transient-get-summary: New generic functionJonas Bernoulli
Replacing `transient-show-summary', which wasn't a good fit, considering that one of the two callers had to use non-nil RETURN argument to prevent the summary from being shown in the echo area.
2026-01-30transient--button-{move,help}-echo: New functionsJonas Bernoulli
2026-01-30transient--match-button: Use key to match suffixesJonas Bernoulli
Multiple suffixes may use the same command but not the same key.
2026-01-30Support returning to more menu elementsJonas Bernoulli
Store the object itself in the `button-date' property for all classes; now also groups, the prefix and information elements. This makes it necessary to check the object type in more places. - In `transient--do-push-button' we have to explicitly do nothing on `transient-information' objects, a class, which at this time derives from `transient-suffix' (which probably should be changed). - We have to add no-op `transient-show-summary' implementations for all classes. Adding these methods is a unfortunate consequence of this change but is a part of the motivation for this change; we just don't implement the behavior in this commit already, to reduce its scope. - For groups `transient--goto-button' no longer receives the description directly but has to recalculate it. `transient--heading-at-point' can be removed since returning to any element is now handled by `transient--goto-button', but that in turn needs a new helper function `transient--match-button' because supporting more classes complicates the matter. This is a bit hacky and we should be able to refine or replace this later on. This also fixes some edge-cases. - Returning to the (optional) menu description is now done explicitly, instead of as a result of failing to locate it. - Returning to a group heading, which isn't in the first column, no longer fails. - Returning to information elements is now supported.
2026-01-30transient-buttonize: New functionJonas Bernoulli
2026-01-30Use button-data text propertyJonas Bernoulli
Instead of our own `suffix' and `command' properties.
2026-01-30Use transient type for all buttonsJonas Bernoulli
2026-01-30Use get-text-property instead of button-getJonas Bernoulli
In most cases we already used the former.