| Age | Commit message (Collapse) | Author |
|
|
|
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.
|
|
|
|
Closes #417
|
|
The built-in `if-let' et al. implementations are no longer used.
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
|
|
Removing the duplication gives us a place and some space to add
documentation.
|
|
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.
|
|
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.
|
|
The advise is ineffective otherwise, as can be observed using
(transient-define-prefix demo ()
[("g" "goto" goto-char :transient t)])
|
|
Turns out `signal' does not accept a single argument in Emacs 30.
This reverts commit 61ed3651df360e1a0c36ff70afbb9ee0f947252a.
|
|
Stefan informed me that this is supported since at least that version.
|
|
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
|
|
If STRINGS is nil, `string-join' returns the empty string, not nil.
Closes #434.
|
|
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
|
|
|
|
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.
|
|
`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.
|
|
`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.
|
|
Closes #428.
|
|
|
|
|
|
For consistency with similar comments elsewhere in this library.
|
|
|
|
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.
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.)
|
|
It is the same as for the parent class.
|
|
|
|
|
|
|
|
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'.
|
|
|
|
|