From fb26ac3ce3838ccc634f89640e5f85329e9b2a50 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Fri, 4 Oct 2024 19:22:53 +0200 Subject: [PATCH] transient--parse-suffix: Fix regression breaking :setup-children In [1: fb88f803] 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: fb88f803], which stopped using `macroexp-quote'. Closes #313. Closes tarsius/notmuch-transient#2. 1: 2024-09-02 fb88f803e85fa0b9e1319e90b5e71020b6543d94 transient--parse-suffix: Clarify clause, removing dead code --- CHANGELOG | 8 ++++++++ lisp/transient.el | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 269d157..914afc2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/lisp/transient.el b/lisp/transient.el index d5d422a..e0efe70 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -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