mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Allow browsing an URL explicitly with an internal or external browser.
* lisp/net/browse-url.el (browse-url-with-browser-kind): New command.
This commit is contained in:
parent
b0f9cbb3da
commit
b2581eea1b
1 changed files with 28 additions and 0 deletions
|
|
@ -928,6 +928,34 @@ Optional prefix argument ARG non-nil inverts the value of the option
|
|||
browse-url-new-window-flag))
|
||||
(error "No URL found"))))
|
||||
|
||||
;;;###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 (completing-read
|
||||
(format "Browser kind (default %s): " 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)))
|
||||
|
||||
;;;###autoload
|
||||
(defun browse-url-at-mouse (event)
|
||||
"Ask a WWW browser to load a URL clicked with the mouse.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue