Function: browse-url-with-browser-kind
browse-url-with-browser-kind is an autoloaded, interactive and
byte-compiled function defined in browse-url.el.gz.
Signature
(browse-url-with-browser-kind KIND URL &optional ARG)
Documentation
Browse URL with a browser of the given browser KIND.
KIND is either internal or external. In order to find an
appropriate browser for the given KIND, first consult the browse-url-handlers
and browse-url-default-handlers lists. If no handler is found, try the
functions browse-url-browser-function,
browse-url-secondary-browser-function, browse-url-default-browser
and eww, in that order.
When called interactively, the default browser kind is the
opposite of the browser kind of browse-url-browser-function.
Probably introduced at or before Emacs version 28.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/net/browse-url.el.gz
;;;###autoload
(defun browse-url-with-browser-kind (kind url &optional arg)
"Browse URL with a browser of the given browser KIND.
KIND is either `internal' or `external'. In order to find an
appropriate browser for the given KIND, first consult the `browse-url-handlers'
and `browse-url-default-handlers' lists. If no handler is found, try the
functions `browse-url-browser-function',
`browse-url-secondary-browser-function', `browse-url-default-browser'
and `eww', in that order.
When called interactively, the default browser kind is the
opposite of the browser kind of `browse-url-browser-function'."
(interactive
(let* ((url-arg (browse-url-interactive-arg "URL: "))
;; Default to the inverse kind of the default browser.
(default (if (eq (browse-url--browser-kind
browse-url-browser-function (car url-arg))
'internal)
'external
'internal))
(k (intern (completing-read
(format-prompt "Browser kind" default)
'(internal external)
nil t nil nil
default))))
(cons k url-arg)))
(let ((function (browse-url-select-handler url kind)))
(unless function
(setq function
(seq-find
(lambda (fun)
(eq kind (browse-url--browser-kind fun url)))
(list browse-url-browser-function
browse-url-secondary-browser-function
#'browse-url-default-browser
#'eww))))
(funcall function url arg)))