| Age | Commit message (Collapse) | Author |
|
|
|
By using a dedicated symbol, which uses our package prefix, we ensure
that we can set `read-extended-command-predicate', without affecting
any unrelated package.
`transient-command-completion-not-suffix-only-p' only prevents
"anonymously defined" transient suffix commands from being offered as
`read-extended-command' completion candidates. Furthermore, because
we only set `read-extended-command-predicate' iff it is non-nil, this
does not mess with any user customization of this option. Also note
that if the user uses `command-completion-default-include-p' instead,
then the suffix-only commands are also filtered out.
IMO it is reasonable for a package to use this feature to declare
that certain commands should absolutely never be offered as completion
candidates. The interface of this feature is not optimized for this
use-case, but I predict that `read-extended-command-predicate' will
one day be a hook, at which point I would not have to write this
explanation in the hope that it convincingly makes the case for why
daring to us it to achieve the goal that it was designed to achieve
is not Wrong™, not even if it is a library that does it, as opposed
to a user.
It has been suggested that Transient should instead avoid `intern'ing
any symbols for these (admittedly not fully) anonymous suffix
commands. The proposed patch does not actually work, because these
symbols *have to be* interned, and for backward compatibility reasons
`transient--init-suffix' ensures that they are. So initially (at
load-time) these suffix command symbols would not be interned but as
the user invokes transient commands, more and more of them would
become interned.
We could avoid interning anonymously defined suffix commands
altogether, but that would have unfortunate consequences. In fact
Transient used to do that because `read-extended-command-predicate'
did not exist yet. But I sure wished it did, and I was considering
implementing something like that myself. So of course once that
feature appear, I was happy to take advantage, in [1: 226db67b].
Going back to not binding every suffix command to an interned symbol,
would complicate matters considerably. It would lead to bugs, and
would slow down development, because I would constantly have to double
check changes, to reduce the risk of introducing such bugs. The code
would be more difficult to understand. Frankly, doing so would mean
intentionally adding accidental complexity. I very much want to avoid
that oxymoron.
Furthermore, not interning anonymously defined suffixes, would do
nothing to hide infix arguments that are explicitly defined using
`transient-define-infix', but those should also not be offered as
completion candidates. The approach I have chosen does.
Instead of #273.
1: 2023-08-12 226db67b3680acbeb74cb0403e1a302917054174
All suffix commands now must be accessed through fbound symbols
|
|
|
|
It is a more natural fit but didn't exist yet when I first learned
about this feature. Both properties were introduced in Emacs 28.1.
|
|
Without this the transient window would not be deleted when the
debugger is entered.
|
|
Do this in a separate commit because the diff sure looks like much
more changed than just some whitespace.
|
|
We already fall back to making the suffix's key part of the name of
the command, when its description is a lambda. Do the same if it is
a named function, and if it is a string, then only use it if it is
less than 16 characters long.
(As a side-note, using the description has the advantage that more
meaningful symbols appear in backtraces. While falling back to using
the key, is less meaningful (and users may change the key, leading to
a mismatch), it is still much more useful than using `gensym'.)
|
|
|
|
Since [1: 5f2cfc9f] we try to detect whether there is an outer
prefix, that non-transient suffixes could return to, by checking
if `transient--current-prefix' is non-nil. That works then the
prefix is created, but that variable is also always non-nil after
a transient suffix is invoked. Instead check if `transient--stack'
is non-nil.
1: 2023-11-29 5f2cfc9f73e756fb337df70909fcd3d0bce56911
transient--make-predicate-map: Only return if there is a parent
|
|
|
|
|
|
|
|
Previously this resulted in an `excessive-lisp-nesting' error.
|
|
|
|
We try to dedicate the transient window to the transient buffer, but
that does not actually guarantee that it is not used to displayed
another buffer. Normally displaying another buffer in this window
would be fatal, but if it happens when displaying the *Help* buffer,
then that works out okay, as long as we avoid immediately killing
that buffer again.
Closes #271.
|
|
|
|
|
|
|
|
Bind it to the column group for which a suffix is currently being
inserted.
Fixes #269.
|
|
|
|
|
|
|
|
|
|
|
|
This introduction by JD Smith was first published on
the wiki [1][2]. At popular demand, we now use it as
the official introduction.
[1]: https://github.com/magit/transient/wiki
[2]: https://github.com/magit/transient.wiki.git
Co-authored-by: Jonas Bernoulli <jonas@bernoul.li>
Some light editorial work.
|
|
|
|
|
|
|
|
|
|
We now require at least Emacs 26.1.
|
|
|
|
|
|
Before Emacs 28, the value had to be a number. In Emacs 30 it can
be a cons-cell of two numbers, but the manual says that it can still
be a number. But that doesn't seem to work for all Emacs releases
in between, at least not when using a negative number.
Try to cater to the preferences of various Emacs releases.
|
|
Since this is the only use of `transient-define-suffix' in
"transient.el" itself, it might be looked at for inspiration, so use
`transient-prefix-object', instead of `transient--prefix', which in
this case would be equivalent, but is intended for internal use only.
Hopefully this helps avoiding some confusion.
|
|
|
|
Only prepare to return to the parent transient if there actually
is a parent. The only negative effect of failing to do this was
that the suffix was colored wrong, since `transient--do-return'
falls back to behave like `transient--do-exit'.
|
|
|
|
|
|
|
|
|
|
There actually is a binding for [nil], in `transient--predicate-map',
and it's not always what we need when determining the color (and thus
pre-command) for non-suffixes (via `transient--separator-line').
|
|
|
|
|
|
Remove `transient--anonymous-infix-argument', which was originally
used for the same purpose, but was dead code since [1: 226db67b].
1: 2023-08-12 226db67b3680acbeb74cb0403e1a302917054174
All suffix commands now must be accessed through fbound symbols
|
|
|
|
|
|
|
|
|
|
Without this, toggling an *option* off (i.e., without using the
minibuffer) causes the use of `transient-active-infix' to stick
around.
|
|
Most importantly give them distinct looks, and use colors appropriate
to the severity of the potential issue. I.e., mismatched keys should
be avoided if at all possible, while adding a shorthand-like binding
for an argument that doesn't exist as a shorthand, cannot be avoided,
and hiding come suffixes from users is also something that is often
done intentionally.
|