| Age | Commit message (Collapse) | Author |
|
|
|
We only started this validation in [1: 45de8e46] and the justification
boiled down to "we might as well".
However these functions are being called by `transient--get-layout',
*before* that had a chance to upgrade from the old to the new format,
and here we perform the validation by calling `transient--get-layout',
which together resulted in an infinite loop, and this errors being
repeated many times:
Not a legacy group definition: PREFIX: \
(error "Not a transient prefix command or group definition: PREFIX")
1: 2025-05-16 45de8e46f066eab3160f62cbcc76859022c9c1cc
transient-parse-suffix: Accept object as prefix
|
|
We already call `transient--post-exit', which also takes care of this,
but to be absolutely sure, also reset here and unconditionally (i.e.,
even if `transient--prefix' is nil or `transient--exitp' is `replace').
Before the emergency exit was added, unexpected bugs could look up
Emacs. That does not happen anymore, and we can also rely on it
to guarantee quitting is enabled again.
|
|
|
|
Re #388.
|
|
Like the somewhat similar but much less complex `read-key-sequence',
for example, Transient menus should inhibit quitting, otherwise C-g
might, for example, kill some subprocess, when the user intended to
exit the menu.
Due to how Transient is implemented, there is nothing around which we
could let-bind `inhibit-quit', like that is usually done. Instead we
have to set the global value and make sure we reset that when exiting
the menu.
The resetting has to happen on `post-command-hook' but at that time
a let-binding for `inhibit-quit' is in effect, so we have to use
`set-default-toplevel-value', instead of `setq'.
Closes #388.
|
|
Command-line switches can be defined inline in a prefix definition
like so:
("-s" "My switch" "--switch")
("-o" "My option" "--option=")
Support something similar for `transient-cons-option':
("c" "My option" :cons option)
("o" :cons other-option)
("r" :cons number-option :reader read-number)
|
|
The existing `transient-option' class is suitable for options passed to
commands. A suffix that uses that class may represent an argument such
as "--option". In the list returned by `transient-args', that argument
and its value, "value", is represented as one element "--option=value".
For "options" that are not passed to a command that is not appropriate.
A caller that wants to extract the value of such an option would have
to parse that string. `transient-arg-value' can help with that, but it
always returns a string (or nil).
The new `transient-cons-option' class provides a more direct way to deal
with "non-command-line options", by representing the key value pair
using a cons-cell (ARGUMENT . VALUE), not just internally, but in
particular when handing it of to a caller. VALUE can have any printable
type and ARGUMENT can have any printable type, expect string.
We cannot use the term "key" because that is already used to the key
binding for the command. Also avoid using "property" because that
implies a property list, while the value returned by `transient-args'
is an alist when all infixes use the `transient-cons-options' class.
Sticking to "argument" also has the advantage, that we don't have to
implement or generalize a dozen methods.
|
|
|
|
|
|
|
|
Include "suffix" in the name, same as in `transient--suffix-props'.
The name of the argument ("spec") should be enough to make it clear
what the expected form of the "suffix" is.
|
|
On newer releases (kbd nil) returns "",
but when using Emacs 28 it signals an error.
Closes #5376.
|
|
|
|
That's only natural, given that the group vectors are self-quoting,
while the values in the preceding property list are evaluated. For
backward compatibility the quoting is optional, for now at least.
|
|
- Improve the internal format used to store layouts. This makes
handling easier and results in prettier pretty-printing.
- Store the level property in the same plist for all other properties.
- Reduce nesting of elements.
- Wrap a prefix's top-level groups in a vector, which has the same
form the vectors used for actual groups, except that its first
element specifies the layout format version (currently 2), instead
of the group class. Previously a raw list was used, which had the
considerable disadvantage that the top-level required special cases,
compared to groups and suffixes found at deeper levels.
- When encountering a layout that still used the old format, convert
it on the fly and update the store layout.
- No longer inline included groups by default.
- Store the symbol that identifies the separately defined group in the
layout of the prefix (or other group) that includes it. Previously
its expansion was immediately inlined.
- When modifying an included group, either directly or via a prefix
which includes it, then this affects all prefixes that include it.
- The new function `transient-inline-group' can be used in the rare
case that this is not desirable.
- Instead of group vectors that macro also accepts suffix lists as
arguments, to maintain the ability to include lists of suffixes,
not just individual groups or list of groups. However, this is
semi-deprecated and undocumented.
- The new function `transient-define-group' can be used to define a
group or set of groups, to be included in prefixes. It stores the
layout the same way as `transient-define-prefix', in parsed form.
|
|
It won't remain an alias for long.
|
|
That's preferable to hardcoding a magical number in several places,
and makes it possible to identify all places where we access suffix
property lists.
|
|
And if PREFIX is a symbol, actually assert that it identifies a
prefix.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
No longer support vectors. This change isn't backward compatible but
I haven't seen a vector being used even just once.
It also makes sense to take inspiration from `keymap-set' et al., which
didn't exist when Transient was created.
However, we continue to be more permissive than those functions, only
insisting on strings understood by `kbd', including strings that do not
satisfy `key-valid-p'. Being more permissive makes it possible, for
example, to write the key binding, which toggles the "-a" command line
argument, as "-a", instead of having to write "- a". Likewise
additional spaces can be added, which are not removed when displaying
the binding in the menu, which is useful for alignment purposes.
|
|
|
|
|
|
|
|
|
|
From the docstring of `text-conversion-style', which appears to
also apply to `overriding-text-conversion-style':
> This variable does not take immediate effect when set; rather, it
> takes effect upon the next redisplay after the selected window or
> its buffer changes.
If we trigger the suspension before we create the transient window
and buffer, which causes a redisplay, then our setting has a chance
to kick in.
Re #376.
|
|
It has been reported that this is necessary on Android and the author
of the Android port suspends this for Isearch too, see [1: 2dcce30290d].
We set `overriding-text-conversion-style' instead of the buffer-local
`text-conversion-style' because some menus allow switching to another
buffer while the menu is still active.
Closes #376.
Closes #377.
1: 2023-02-16 2dcce30290dc7782e9de3b4adf59f38b42408c98
Update Android port
|
|
|
|
|
|
|
|
|
|
In [1: 8daf9890] we started to signal an error instead of merely
showing a message on failure. That was a mistake, see #374.
Add new option `transient-error-on-insert-failure', so users can
opt-in to fatal errors for minor issues.
1: 2025-03-24 8daf9890ee65335a23eebc8919e9cfdd7c7249eb
transient--insert-suffix: Signal error if location is invalid
|
|
|
|
|
|
Do so before trying to access the prototype suffix object.
|
|
Closes #374.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|