Search RSS links from end of article

The “Link” link is usually placed at the very end of the article, so search from there.
Furthermore, when another link also contains “Link”, searching from the end will avoid opening this
link instead.
This commit is contained in:
Daniel Borchmann 2025-06-22 10:44:08 +02:00
parent 7a14c64ef0
commit 762d035611
No known key found for this signature in database
GPG Key ID: 50EA937BF472ADD1

View File

@ -318,7 +318,7 @@ METHOD specifies the encrypt method used. Can be either
(delete-trailing-whitespace))) (delete-trailing-whitespace)))
(defun db/gnus-summary-open-Link () (defun db/gnus-summary-open-Link ()
"Open link named \"Link\" in current article." "Open last link named \"Link\" in current article."
(interactive) (interactive)
(save-window-excursion (save-window-excursion
(save-mark-and-excursion (save-mark-and-excursion
@ -327,10 +327,10 @@ METHOD specifies the encrypt method used. Can be either
(let ((url nil)) (let ((url nil))
(unless (eq major-mode 'gnus-article-mode) (unless (eq major-mode 'gnus-article-mode)
(gnus-summary-select-article-buffer)) (gnus-summary-select-article-buffer))
(goto-char (point-min)) (goto-char (point-max))
(while (and (not url) (while (and (not url)
(search-forward "Link")) (search-backward "Link"))
(backward-char) (forward-char)
(setq url (get-text-property (point) 'shr-url))) (setq url (get-text-property (point) 'shr-url)))
(when url (when url
(browse-url url))))))) (browse-url url)))))))