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 SECONDARY)

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 secondary)
  "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 (gnus-collect-urls-from-article))
         (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
        (let ((browse-url-browser-function
               (if secondary
                   browse-url-secondary-browser-function
                 browse-url-browser-function)))
          (browse-url target))
      (message "No URLs found."))))