aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/net/browse-url.el24
2 files changed, 28 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 3b3164c2582..4e41dbb39a8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -275,6 +275,10 @@ whose content matches a regexp; bound to '% g'.
275'ibuffer-never-search-content-mode' used by 275'ibuffer-never-search-content-mode' used by
276'ibuffer-mark-by-content-regexp'. 276'ibuffer-mark-by-content-regexp'.
277 277
278** Browse-URL
279
280*** Support for opening links to man pages in Man or WoMan mode.
281
278** Compilation mode 282** Compilation mode
279 283
280--- 284---
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index c0b359176ec..1bb48314bc8 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -184,6 +184,15 @@ be used instead."
184 :version "24.1" 184 :version "24.1"
185 :group 'browse-url) 185 :group 'browse-url)
186 186
187(defcustom browse-url-man-function 'browse-url-man
188 "Function to display man: links."
189 :type '(radio
190 (function-item :tag "Emacs Man" :value browse-url-man)
191 (const :tag "None" nil)
192 (function :tag "Other function"))
193 :version "26.1"
194 :group 'browse-url)
195
187(defcustom browse-url-netscape-program "netscape" 196(defcustom browse-url-netscape-program "netscape"
188 ;; Info about netscape-remote from Karl Berry. 197 ;; Info about netscape-remote from Karl Berry.
189 "The name by which to invoke Netscape. 198 "The name by which to invoke Netscape.
@@ -801,6 +810,8 @@ as ARGS."
801 (let ((process-environment (copy-sequence process-environment)) 810 (let ((process-environment (copy-sequence process-environment))
802 (function (or (and (string-match "\\`mailto:" url) 811 (function (or (and (string-match "\\`mailto:" url)
803 browse-url-mailto-function) 812 browse-url-mailto-function)
813 (and (string-match "\\`man:" url)
814 browse-url-man-function)
804 browse-url-browser-function)) 815 browse-url-browser-function))
805 ;; Ensure that `default-directory' exists and is readable (b#6077). 816 ;; Ensure that `default-directory' exists and is readable (b#6077).
806 (default-directory (or (unhandled-file-name-directory default-directory) 817 (default-directory (or (unhandled-file-name-directory default-directory)
@@ -1588,6 +1599,19 @@ used instead of `browse-url-new-window-flag'."
1588 (unless (bolp) 1599 (unless (bolp)
1589 (insert "\n")))))))) 1600 (insert "\n"))))))))
1590 1601
1602;; --- man ---
1603
1604(defvar manual-program)
1605
1606(defun browse-url-man (url &optional _new-window)
1607 "Open a man page."
1608 (interactive (browse-url-interactive-arg "Man page URL: "))
1609 (require 'man)
1610 (setq url (replace-regexp-in-string "\\`man:" "" url))
1611 (cond
1612 ((executable-find manual-program) (man url))
1613 (t (woman (replace-regexp-in-string "([[:alnum:]]+)" "" url)))))
1614
1591;; --- Random browser --- 1615;; --- Random browser ---
1592 1616
1593;;;###autoload 1617;;;###autoload