summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2025-06-24 15:57:17 +0200
committerJonas Bernoulli <jonas@bernoul.li>2025-06-24 15:57:17 +0200
commite508e65866168c178136e260a86790cd12343024 (patch)
tree54c29b08fef33ea5983196641bea7e4ffcc114fd
parent415f74bf97f6dd8e76131cd5cb3a9a8f77c273e5 (diff)
transient--goto-button: No longer error if no button is found
This could happen, for example, if a menu only has a single suffix and invoking that suffix causes it to be removed from the menu. That is a rather contrived use-case, but see #397.
-rw-r--r--lisp/transient.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/transient.el b/lisp/transient.el
index 4117c56..3e72990 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -5123,7 +5123,9 @@ See `forward-button' for information about N."
(when (re-search-forward (concat "^" (regexp-quote command)) nil t)
(goto-char (match-beginning 0))))
(command
- (cl-flet ((found () (eq (button-get (button-at (point)) 'command) command)))
+ (cl-flet ((found ()
+ (and-let* ((button (button-at (point))))
+ (eq (button-get button 'command) command))))
(while (and (ignore-errors (forward-button 1))
(not (found))))
(unless (found)