summaryrefslogtreecommitdiff
path: root/lisp/help-mode.el
diff options
context:
space:
mode:
authorBill Wohler <wohler@newt.com>2005-10-28 21:27:13 +0000
committerBill Wohler <wohler@newt.com>2005-10-28 21:27:13 +0000
commit5c825567d0a21d1c2b487323dc2a3c0d95bdf639 (patch)
treed7d3b3dcab595df36765c0529b63e6c8992f4701 /lisp/help-mode.el
parent7c06485983433cca0cce207b96a9e40fd6a46b5d (diff)
downloademacs-5c825567d0a21d1c2b487323dc2a3c0d95bdf639.tar.gz
(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.
Diffstat (limited to 'lisp/help-mode.el')
-rw-r--r--lisp/help-mode.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index eac7caad0ca..a2e7fb88663 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -126,7 +126,12 @@ The format is (FUNCTION ARGS...).")
(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 @@ when help commands related to multilingual environment (e.g.,
(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 @@ that."
(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.