Mercurial > emacs
comparison lisp/help-mode.el @ 66513:bfd70a868157
(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.
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Fri, 28 Oct 2005 21:27:13 +0000 |
parents | 41bb365f41c4 |
children | 2f22c8af038b |
comparison
equal
deleted
inserted
replaced
66512:759df5a9dc3e | 66513:bfd70a868157 |
---|---|
124 'help-echo (purecopy "mouse-2, RET: go back to previous help buffer")) | 124 'help-echo (purecopy "mouse-2, RET: go back to previous help buffer")) |
125 | 125 |
126 (define-button-type 'help-info | 126 (define-button-type 'help-info |
127 :supertype 'help-xref | 127 :supertype 'help-xref |
128 'help-function #'info | 128 'help-function #'info |
129 'help-echo (purecopy"mouse-2, RET: read this Info node")) | 129 'help-echo (purecopy "mouse-2, RET: read this Info node")) |
130 | |
131 (define-button-type 'help-url | |
132 :supertype 'help-xref | |
133 'help-function #'browse-url | |
134 'help-echo (purecopy "mouse-2, RET: view this URL in a browser")) | |
130 | 135 |
131 (define-button-type 'help-customize-variable | 136 (define-button-type 'help-customize-variable |
132 :supertype 'help-xref | 137 :supertype 'help-xref |
133 'help-function (lambda (v) | 138 'help-function (lambda (v) |
134 (if help-xref-stack | 139 (if help-xref-stack |
254 | 259 |
255 | 260 |
256 (defconst help-xref-info-regexp | 261 (defconst help-xref-info-regexp |
257 (purecopy "\\<[Ii]nfo[ \t\n]+\\(node\\|anchor\\)[ \t\n]+`\\([^']+\\)'") | 262 (purecopy "\\<[Ii]nfo[ \t\n]+\\(node\\|anchor\\)[ \t\n]+`\\([^']+\\)'") |
258 "Regexp matching doc string references to an Info node.") | 263 "Regexp matching doc string references to an Info node.") |
264 | |
265 (defconst help-xref-url-regexp | |
266 (purecopy "\\<[Uu][Rr][Ll][ \t\n]+`\\([^']+\\)'") | |
267 "Regexp matching doc string references to a URL.") | |
259 | 268 |
260 ;;;###autoload | 269 ;;;###autoload |
261 (defun help-setup-xref (item interactive-p) | 270 (defun help-setup-xref (item interactive-p) |
262 "Invoked from commands using the \"*Help*\" buffer to install some xref info. | 271 "Invoked from commands using the \"*Help*\" buffer to install some xref info. |
263 | 272 |
336 (let ((data (match-string 2))) | 345 (let ((data (match-string 2))) |
337 (save-match-data | 346 (save-match-data |
338 (unless (string-match "^([^)]+)" data) | 347 (unless (string-match "^([^)]+)" data) |
339 (setq data (concat "(emacs)" data)))) | 348 (setq data (concat "(emacs)" data)))) |
340 (help-xref-button 2 'help-info data)))) | 349 (help-xref-button 2 'help-info data)))) |
350 ;; URLs | |
351 (save-excursion | |
352 (while (re-search-forward help-xref-url-regexp nil t) | |
353 (let ((data (match-string 1))) | |
354 (help-xref-button 1 'help-url data)))) | |
341 ;; Mule related keywords. Do this before trying | 355 ;; Mule related keywords. Do this before trying |
342 ;; `help-xref-symbol-regexp' because some of Mule | 356 ;; `help-xref-symbol-regexp' because some of Mule |
343 ;; keywords have variable or function definitions. | 357 ;; keywords have variable or function definitions. |
344 (if help-xref-mule-regexp | 358 (if help-xref-mule-regexp |
345 (save-excursion | 359 (save-excursion |