From bb103abb7f20736b6a5bdea7706d0bf850a8c7e1 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Mon, 4 Nov 2024 13:22:22 +0100 Subject: [PATCH] transient-suffix-object: Restore fallback behavior during setup In [1: 1b7f9be7] we started to signal an error if there are multiple bindings for the command and we cannot determine the correct suffix object based on the key binding. When COMMAND is non-nil, then this function is not being called on behalf of `this-command'. In that case `this-command-keys' is also meaningless, and when COMMAND has multiple bindings, then COMMAND cannot be mapped to a single suffix object. Go back to returning the first object. Closes #325. 1: 2024-11-02 1b7f9be7b9fbc8acb5d71f028b19e1f78d9dd090 transient-suffix-object: Drop faulty fallback behavior --- lisp/transient.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/transient.el b/lisp/transient.el index 5a98654..fe8fea8 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -1709,7 +1709,12 @@ probably use this instead: (listify-key-sequence (this-command-keys)))) suffixes) (car suffixes)) - (error "BUG: Cannot determine suffix object")))) + ;; COMMAND is only provided if `this-command' is meaningless, in + ;; which case `this-command-keys' is also meaningless, making it + ;; impossible to disambiguate redundant bindings. + (if command + (car suffixes) + (error "BUG: Cannot determine suffix object"))))) ((and-let* ((obj (transient--suffix-prototype (or command this-command))) (obj (clone obj))) (progn ; work around debbugs#31840