[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master e089c31: Add `gnus-collect-urls-primary-text'
From: |
Sam Steingold |
Subject: |
[Emacs-diffs] master e089c31: Add `gnus-collect-urls-primary-text' |
Date: |
Wed, 24 Jul 2019 16:44:41 -0400 (EDT) |
branch: master
commit e089c3141a51bf70b91da21a01cdb4be0b63c08d
Author: Sam Steingold <address@hidden>
Commit: Sam Steingold <address@hidden>
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.
---
lisp/gnus/gnus-sum.el | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index fdecad4..06d3db8 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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master e089c31: Add `gnus-collect-urls-primary-text',
Sam Steingold <=