aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/gnus
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-07-28 15:55:31 +0200
committerLars Ingebrigtsen2019-07-28 15:55:37 +0200
commita32e1feb438e793a8378671c7124d226b58f65f0 (patch)
tree238eed9aeda4abfd361c57f557cfb1154d4640da /lisp/gnus
parentdcba39b445e8f71c5f8df34a38ae8fc726a51843 (diff)
downloademacs-a32e1feb438e793a8378671c7124d226b58f65f0.tar.gz
emacs-a32e1feb438e793a8378671c7124d226b58f65f0.zip
Enable browse-url to buttonize buffers
This patch also moves the internal/external browser logic from shr to browse-url, where it belongs more naturally. * doc/misc/eww.texi (Basics): Adjust to browse-url-external-browser. * doc/misc/gnus.texi (Article Commands): Ditto. * lisp/gnus/gnus-art.el (gnus-button-url-regexp): Default to `browse-url-button-regexp', which has taken over the definition previously enjoyed by this variable. * lisp/gnus/gnus-sum.el (gnus-summary-browse-url): Adjust usage. * lisp/net/browse-url.el (browse-url--browser-defcustom-type): New internal variable... (browse-url-browser-function, browse-url-external-browser): Used by these two; the latter of which is a new variable. (browse-url-botton-regexp): New variable. (browse-url-button-map): New keymap. (browse-url-button): New face. (browse-url-add-buttons): New function to add clickable browse-url buttons to almost any buffer. (browse-url-button-open): New command. (browse-url-button-copy): New command. * lisp/net/eww.el (eww-browse-with-external-browser) (eww-follow-link): Adjust usage. * lisp/net/shr.el (shr-external-browser): Make an obsolete alias of `browse-url-external-browser'. (shr-browse-url): Adjust usage.
Diffstat (limited to 'lisp/gnus')
-rw-r--r--lisp/gnus/gnus-art.el22
-rw-r--r--lisp/gnus/gnus-sum.el4
2 files changed, 4 insertions, 22 deletions
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 65e1c8106d5..89f57712c56 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -7343,27 +7343,9 @@ groups."
7343 7343
7344;; Written by Per Abrahamsen <abraham@iesd.auc.dk>. 7344;; Written by Per Abrahamsen <abraham@iesd.auc.dk>.
7345 7345
7346;;; Internal Variables: 7346(defcustom gnus-button-url-regexp browse-url-button-regexp
7347
7348(defcustom gnus-button-url-regexp
7349 (concat
7350 "\\b\\(\\(www\\.\\|\\(s?https?\\|ftp\\|file\\|gopher\\|"
7351 "nntp\\|news\\|telnet\\|wais\\|mailto\\|info\\):\\)"
7352 "\\(//[-a-z0-9_.]+:[0-9]*\\)?"
7353 (let ((chars "-a-z0-9_=#$@~%&*+\\/[:word:]")
7354 (punct "!?:;.,"))
7355 (concat
7356 "\\(?:"
7357 ;; Match paired parentheses, e.g. in Wikipedia URLs:
7358 ;; http://thread.gmane.org/47B4E3B2.3050402@gmail.com
7359 "[" chars punct "]+" "(" "[" chars punct "]+" "[" chars "]*)"
7360 "\\(?:" "[" chars punct "]+" "[" chars "]" "\\)?"
7361 "\\|"
7362 "[" chars punct "]+" "[" chars "]"
7363 "\\)"))
7364 "\\)")
7365 "Regular expression that matches URLs." 7347 "Regular expression that matches URLs."
7366 :version "24.4" 7348 :version "27.1"
7367 :group 'gnus-article-buttons 7349 :group 'gnus-article-buttons
7368 :type 'regexp) 7350 :type 'regexp)
7369 7351
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index b239890c884..d3103bd4b20 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -9478,7 +9478,7 @@ The 1st element is the widget named by `gnus-collect-urls-primary-text'."
9478 "Scan the current article body for links, and offer to browse them. 9478 "Scan the current article body for links, and offer to browse them.
9479 9479
9480Links are opened using `browse-url' unless a prefix argument is 9480Links are opened using `browse-url' unless a prefix argument is
9481given: Then `shr-external-browser' is used instead. 9481given: Then `browse-url-external-browser' is used instead.
9482 9482
9483If only one link is found, browse that directly, otherwise use 9483If only one link is found, browse that directly, otherwise use
9484completion to select a link. The first link marked in the 9484completion to select a link. The first link marked in the
@@ -9502,7 +9502,7 @@ default."
9502 (car urls))))) 9502 (car urls)))))
9503 (if target 9503 (if target
9504 (if external 9504 (if external
9505 (funcall shr-external-browser target) 9505 (funcall browse-url-external-browser target)
9506 (browse-url target)) 9506 (browse-url target))
9507 (message "No URLs found."))))) 9507 (message "No URLs found.")))))
9508 9508