emacs-31 58e4dc3c53a: Fix void-function on push-button in goto-address-mode

Juri Linkov <[email protected]> Mon, 20 Jul 2026 11:39:05 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit 58e4dc3c53ab5f685d5077ec6a592e27e141cb08
Author: Aaron L. Zeng <[email protected]>
Commit: Juri Linkov <[email protected]>

    Fix void-function on push-button in goto-address-mode
    
    * lisp/net/goto-addr.el (goto-address--button-action):
    New function (bug#81419).
    (goto-address-fontify): Use it as the button action.
    
    Copyright-paperwork-exempt: yes
---
 lisp/net/goto-addr.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lisp/net/goto-addr.el b/lisp/net/goto-addr.el
index 09166fe1d5b..fccfa4b7438 100644
--- a/lisp/net/goto-addr.el
+++ b/lisp/net/goto-addr.el
@@ -191,6 +191,7 @@ and `goto-address-fontify-p'."
 	    (overlay-put this-overlay
 			 'keymap goto-address-highlight-keymap)
 	    (overlay-put this-overlay 'button this-overlay)
+	    (overlay-put this-overlay 'action #'goto-address--button-action)
 	    (overlay-put this-overlay 'category 'goto-address)
 	    (overlay-put this-overlay 'goto-address t))))
       (goto-char (or start (point-min)))
@@ -250,6 +251,12 @@ using `browse-url-secondary-browser-function' instead."
             (browse-url-button-open-url url)
           (error "No e-mail address or URL found"))))))
 
+(defun goto-address--button-action (button)
+  "Open the URL represented by BUTTON."
+  (save-excursion
+    (goto-char (overlay-start button))
+    (goto-address-at-point)))
+
 (defun goto-address-find-address-at-point ()
   "Find e-mail address around or before point.
 Then search backwards to beginning of line for the start of an e-mail