]> git.eshelyaron.com Git - emacs.git/commitdiff
(help-url): New button type. Calls browse-url.
authorBill Wohler <wohler@newt.com>
Fri, 28 Oct 2005 21:27:13 +0000 (21:27 +0000)
committerBill Wohler <wohler@newt.com>
Fri, 28 Oct 2005 21:27:13 +0000 (21:27 +0000)
(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.

lisp/ChangeLog
lisp/help-mode.el

index 727cf1e33aee9c9d50c52f854622367d56da8acc..28f0574d327a7b010cd21279a0ff500033f748b1 100644 (file)
@@ -1,3 +1,11 @@
+2005-10-28  Bill Wohler  <wohler@newt.com>
+
+       * 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  <nickrob@snap.net.nz>
 
        * tool-bar.el (tool-bar-add-item-from-menu)
index eac7caad0cadbde38c9bcd88b088706572e4baa0..a2e7fb88663367328efdd3ba94673f16a171b438 100644 (file)
@@ -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.