diff options
| author | Sam Steingold <sds@gnu.org> | 2019-07-24 16:44:03 -0400 |
|---|---|---|
| committer | Sam Steingold <sds@gnu.org> | 2019-07-24 16:44:21 -0400 |
| commit | e089c3141a51bf70b91da21a01cdb4be0b63c08d (patch) | |
| tree | 95660f73135f8de637592c662ef1207e76750440 | |
| parent | 50126f2049a03d2910412572c98bafbc26f3db31 (diff) | |
| download | emacs-e089c3141a51bf70b91da21a01cdb4be0b63c08d.tar.gz | |
Add `gnus-collect-urls-primary-text'
* lisp/gnus/gnus-sum.el (gnus-collect-urls-primary-text): Add defcustom.
(gnus-collect-urls): Use it.
(gnus-summary-browse-url): Mention it in the docstring.
| -rw-r--r-- | lisp/gnus/gnus-sum.el | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index fdecad4e424..06d3db81257 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -9434,10 +9434,16 @@ With optional ARG, move across that many fields." (goto-char (point-max))) (widget-backward arg))) +(defcustom gnus-collect-urls-primary-text "Link" + "The widget text for the default link in `gnus-summary-browse-url'." + :version "27.1" + :type 'string + :group 'gnus-article-various) + (defun gnus-collect-urls () "Return the list of URLs in the buffer after (point). -The 1st element is the one named 'Link', if any." - (let ((pt (point)) urls link) +The 1st element is the widget named by `gnus-collect-urls-primary-text'." + (let ((pt (point)) urls primary) (while (progn (widget-move 1 t) ; no echo ;; `widget-move' wraps around to top of buffer. (> (point) pt)) @@ -9446,12 +9452,13 @@ The 1st element is the one named 'Link', if any." (u (or (widget-value w) (get-text-property pt 'gnus-string)))) (when (string-match-p "\\`[[:alpha:]]+://" u) - (if (and (null link) (string= "Link" (widget-text w))) - (setq link u) + (if (and gnus-collect-urls-primary-text (null primary) + (string= gnus-collect-urls-primary-text (widget-text w))) + (setq primary u) (push u urls))))) (setq urls (nreverse urls)) - (when link - (push link urls)) + (when primary + (push primary urls)) (delete-dups urls))) (defun gnus-summary-browse-url (arg) @@ -9459,7 +9466,9 @@ The 1st element is the one named 'Link', if any." With prefix ARG, also collect links from message headers. Links are opened using `browse-url'. If only one link is found, -browse that directly, otherwise use completion to select a link." +browse that directly, otherwise use completion to select a link. +The first link marked in the article text with +`gnus-collect-urls-primary-text' is the default." (interactive "P") (let (urls target) (gnus-summary-select-article) |
