Skip to content

Commit

Permalink
transient--parse-suffix: Fix regression breaking :setup-children
Browse files Browse the repository at this point in the history
In [1: fb88f80] we wrongly concluded that the only type of function
left to be handled by this branch are `lambda' expressions.  While that
is true during macro-expansion, this function may also be called from a
prefix's `:setup-children' function, in which case we also have to deal
with byte-code function objects and compiled functions.

So go back to handle everything for which `commandp' returns non-nil,
except for strings, which Transient does not support as commands.

Because none of command types supported here have to be quoted, we can
keep the part of [1: fb88f80], which stopped using `macroexp-quote'.

Closes #313.
Closes tarsius/notmuch-transient#2.

1: 2024-09-02 fb88f80
   transient--parse-suffix: Clarify clause, removing dead code
  • Loading branch information
tarsius committed Oct 4, 2024
1 parent c06015c commit fb26ac3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# -*- mode: org -*-
* v0.7.7 UNRELEASED

Bug fix:

- Fix a regression introduced by the previous commit, which broke
dynamic prefixes that use a ~:setup-children~ function to prepare
their suffixes. #313

* v0.7.6 2024-10-01

- ~transient-active-prefix~ now accepts a single prefix symbol, in place
Expand Down
7 changes: 6 additions & 1 deletion lisp/transient.el
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,13 @@ commands are aliases for."
(error "Need command, argument, `:info' or `:info*'; got `%s'" car))
((symbolp car)
(setq args (plist-put args :command (macroexp-quote pop))))
;; During macro-expansion this is expected to be a `lambda'
;; expression. When this is called from a `:setup-children'
;; function, it may also be a byte-code function object or a
;; compiled function. However, we never treat a string as a
;; command, so we have to check for that explicitly.
((and (commandp car)
(eq (car-safe car) 'lambda))
(not (stringp car)))
(let ((cmd pop)
(sym (intern
(format
Expand Down

0 comments on commit fb26ac3

Please # to comment.