diff options
Diffstat (limited to 'lisp/net/browse-url.el')
| -rw-r--r-- | lisp/net/browse-url.el | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 6dc9f8961a8..d7b8521563a 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el | |||
| @@ -929,6 +929,34 @@ Optional prefix argument ARG non-nil inverts the value of the option | |||
| 929 | (error "No URL found")))) | 929 | (error "No URL found")))) |
| 930 | 930 | ||
| 931 | ;;;###autoload | 931 | ;;;###autoload |
| 932 | (defun browse-url-with-browser-kind (kind url &optional arg) | ||
| 933 | "Browse URL with a browser of the given browser KIND. | ||
| 934 | KIND is either `internal' or `external'. | ||
| 935 | |||
| 936 | When called interactively, the default browser kind is the | ||
| 937 | opposite of the browser kind of `browse-url-browser-function'." | ||
| 938 | (interactive | ||
| 939 | (let* ((url-arg (browse-url-interactive-arg "URL: ")) | ||
| 940 | ;; Default to the inverse kind of the default browser. | ||
| 941 | (default (if (eq (browse-url--browser-kind | ||
| 942 | browse-url-browser-function (car url-arg)) | ||
| 943 | 'internal) | ||
| 944 | 'external | ||
| 945 | 'internal)) | ||
| 946 | (k (completing-read | ||
| 947 | (format "Browser kind (default %s): " default) | ||
| 948 | '(internal external) | ||
| 949 | nil t nil nil | ||
| 950 | default))) | ||
| 951 | (cons k url-arg))) | ||
| 952 | (let ((function (browse-url-select-handler url kind))) | ||
| 953 | (unless function | ||
| 954 | (setq function (if (eq kind 'external) | ||
| 955 | #'browse-url-default-browser | ||
| 956 | #'eww))) | ||
| 957 | (funcall function url arg))) | ||
| 958 | |||
| 959 | ;;;###autoload | ||
| 932 | (defun browse-url-at-mouse (event) | 960 | (defun browse-url-at-mouse (event) |
| 933 | "Ask a WWW browser to load a URL clicked with the mouse. | 961 | "Ask a WWW browser to load a URL clicked with the mouse. |
| 934 | The URL is the one around or before the position of the mouse click | 962 | The URL is the one around or before the position of the mouse click |