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.

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'.

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 (if (eq kind 'external)
                         #'browse-url-default-browser
                       #'eww)))
    (funcall function url arg)))