]> git.eshelyaron.com Git - emacs.git/commitdiff
Action button when point is just after it
authorMauro Aranda <maurooaranda@gmail.com>
Sat, 15 Feb 2025 12:43:58 +0000 (09:43 -0300)
committerEshel Yaron <me@eshelyaron.com>
Sun, 9 Mar 2025 10:31:58 +0000 (11:31 +0100)
* lisp/cus-edit.el (Custom-newline): If no button at point,
check for a button before point.  (Bug#72341)

(cherry picked from commit 8bea0aae3bb59bd0452c61f856d74650838f6a45)

lisp/cus-edit.el

index 3b9b32f3360aef7746ca95128d0d46dfa6b4607e..2f14d6590c9e0192f169a20188bf6e44c7d8f719 100644 (file)
@@ -5396,10 +5396,13 @@ The format is suitable for use with `easy-menu-define'."
 To see what function the widget will call, use the
 `widget-describe' command."
   (interactive "@d" Custom-mode)
-  (let ((button (get-char-property pos 'button)))
-    ;; If there is no button at point, then use the one at the start
-    ;; of the line, if it is a custom-group-link (bug#2298).
+  (let ((button (or (get-char-property pos 'button)
+                    ;; Maybe we are just past a button, and it's quite handy
+                    ;; to action it as well.  (Bug#72341)
+                    (get-char-property (1- pos) 'button))))
     (or button
+        ;; If there is no button at point, then use the one at the start
+        ;; of the line, if it is a custom-group-link (bug#2298).
        (if (setq button (get-char-property (line-beginning-position) 'button))
            (or (eq (widget-type button) 'custom-group-link)
                (setq button nil))))