Function: gnus-summary-browse-url

gnus-summary-browse-url is an interactive and byte-compiled function defined in gnus-sum.el.gz.

Signature

(gnus-summary-browse-url &optional EXTERNAL)

Documentation

Scan the current article body for links, and offer to browse them.

Links are opened using browse-url unless a prefix argument is given: Then browse-url-secondary-browser-function is used instead.

If only one link is found, 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.

Probably introduced at or before Emacs version 27.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
(defun gnus-summary-browse-url (&optional external)
  "Scan the current article body for links, and offer to browse them.

Links are opened using `browse-url' unless a prefix argument is
given: Then `browse-url-secondary-browser-function' is used instead.

If only one link is found, 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" gnus-summary-mode)
  (let (urls target)
    (gnus-summary-select-article)
    (gnus-with-article-buffer
      (article-goto-body)
      ;; Back up a char, in case body starts with a button.
      (backward-char)
      (setq urls (gnus-collect-urls))
      (setq target
	    (cond ((= (length urls) 1)
		   (car urls))
		  ((> (length urls) 1)
		   (completing-read
		    (format-prompt "URL to browse"
				   (gnus-shorten-url (car urls) 40))
		    urls nil t nil nil (car urls)))))
      (if target
	  (if external
	      (funcall browse-url-secondary-browser-function target)
	    (browse-url target))
	(message "No URLs found.")))))