| Age | Commit message (Collapse) | Author |
|
To update:
0. At times backport changes from Emacs' "emacs-NN" to Transient.
1. Backport changes from Emacs' "master" to Transient's "main", while
making them backward compatible with released Emacs versions.
Make sure to look at the history of not only "lisp/transient.el",
but also "doc/misc/transient.texi".
2. In Transient, rebase "builtin" onto "main".
Now we have to DISCARD the changes that revert modifications that
have happened in Transient since the last round.
Most changes happen in separate commits. Their messages describe
the changes that should be preserved.
=> Look at each of these commits, even if they do not conflict. Some
contain additional instructions. In particular, do not forget to
fuck up newly added instances of `if-let' et al.
3. In this commit, append "-builtin" to `transient-version'. This
is not the version string the will ultimately be used, see (4)
and (6). This is the only difference between Transient's "builtin"
branch and the actually built-in library.
4. In Transient, sign and update date ("r S"), and run "git describe"
to get "DESC", used below.
5. Copy from Transient's "builtin" to Emacs' "master".
cp ~/.config/emacs/lib/transient/lisp/transient.el \
~/src/emacs/emacs/master/lisp/
cp ~/.config/emacs/lib/transient/docs/transient.texi \
~/src/emacs/emacs/master/doc/misc/
6. In Emacs, set the value of `transient-version' to "DESC-builtin".
7. In Emacs, stage and commit using "Update to Transient DESC" as
message.
|
|
- Use my main email address.
- Use "URL" instead of "Homepage".
I consistently use "Homepage" for all my packages and they
consistently use "URL".
- Use "Version" instead of "Package-Version" because that's
all finder understands, dropping the empty line before it.
- Drop "Package-Requires".
Do NOT change the value of `transient-version'. That is done
in the next commit. I.e., use the same version string as on
the "main" branch, onto which we are rebasing.
|
|
- Drop require for `compat'.
- Drop `seq' kludge.
- Drop `pp-default-function' declaration.
- Drop `signal' backward compatibility.
- Make use of `pcase-setq'.
- Drop backward compatibility in `transient--wrap-command'.
- Expect `string-edit' to exist.
- Expect `string-pixel-width' to exist.
- Expect `overriding-text-conversion-style' to exist.
|
|
This ports the unfortunate Emacs commit [1: 4704dd39de0],
but I refuse to damage the stand-alone version the same way.
[TODO] After every rebase, check for new instances of `and-let',
`if-let', `when-let' and `while-let*', and fuck them up too.
(occur "(\\(\\(and\\|if\\|when\\)-let\\_>\\|while-let\\*\\)")
1: 2024-10-27 4704dd39de0427466ca3585ab284b7302b0ef2d7
transient.el: Replace use of obsolete if-let and when-let
|
|
No comment.
[TODO] After every rebase, check for new instances of `cond-let'
and `cond-let*', and fuck them up too.
(occur "(cond-let")
|
|
That's fair.
[TODO] After every rebase, check for new instances of `and$' and
`when$', and replace them too.
(occur "(\\(and\\|when\\)\\$")
|
|
|
|
I'm not sure whether whitespace in this location is actually
significant, but ox-texinfo does not put it there, while Eli does.
|
|
|
|
Ox-Texinfo uses @ref, but other link types are preferred in Emacs.
|
|
|
|
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.
|
|
|