# HG changeset patch # User Bill Wohler # Date 1130534833 0 # Node ID bfd70a86815795d6bf0e29142b1748dfd99c1759 # Parent 759df5a9dc3e0626c4ce59c0cb7dc267c80ccc41 (help-url): New button type. Calls browse-url. (help-xref-url-regexp): New regexp to recognize URLs in docstring. Similar to Info nodes: URL `url'. (help-make-xrefs): Create help-url buttons for help-xref-url-regexp matches. diff -r 759df5a9dc3e -r bfd70a868157 lisp/ChangeLog --- a/lisp/ChangeLog Fri Oct 28 21:03:35 2005 +0000 +++ b/lisp/ChangeLog Fri Oct 28 21:27:13 2005 +0000 @@ -1,3 +1,11 @@ +2005-10-28 Bill Wohler + + * help-mode.el (help-url): New button type. Calls browse-url. + (help-xref-url-regexp): New regexp to recognize URLs in docstring. + Similar to Info nodes: URL `url'. + (help-make-xrefs): Create help-url buttons for + help-xref-url-regexp matches. + 2005-10-29 Nick Roberts * tool-bar.el (tool-bar-add-item-from-menu) diff -r 759df5a9dc3e -r bfd70a868157 lisp/help-mode.el --- a/lisp/help-mode.el Fri Oct 28 21:03:35 2005 +0000 +++ b/lisp/help-mode.el Fri Oct 28 21:27:13 2005 +0000 @@ -126,7 +126,12 @@ (define-button-type 'help-info :supertype 'help-xref 'help-function #'info - 'help-echo (purecopy"mouse-2, RET: read this Info node")) + 'help-echo (purecopy "mouse-2, RET: read this Info node")) + +(define-button-type 'help-url + :supertype 'help-xref + 'help-function #'browse-url + 'help-echo (purecopy "mouse-2, RET: view this URL in a browser")) (define-button-type 'help-customize-variable :supertype 'help-xref @@ -257,6 +262,10 @@ (purecopy "\\<[Ii]nfo[ \t\n]+\\(node\\|anchor\\)[ \t\n]+`\\([^']+\\)'") "Regexp matching doc string references to an Info node.") +(defconst help-xref-url-regexp + (purecopy "\\<[Uu][Rr][Ll][ \t\n]+`\\([^']+\\)'") + "Regexp matching doc string references to a URL.") + ;;;###autoload (defun help-setup-xref (item interactive-p) "Invoked from commands using the \"*Help*\" buffer to install some xref info. @@ -338,6 +347,11 @@ (unless (string-match "^([^)]+)" data) (setq data (concat "(emacs)" data)))) (help-xref-button 2 'help-info data)))) + ;; URLs + (save-excursion + (while (re-search-forward help-xref-url-regexp nil t) + (let ((data (match-string 1))) + (help-xref-button 1 'help-url data)))) ;; Mule related keywords. Do this before trying ;; `help-xref-symbol-regexp' because some of Mule ;; keywords have variable or function definitions.