diff options
| author | Tassilo Horn | 2020-05-07 13:02:13 +0200 |
|---|---|---|
| committer | Tassilo Horn | 2020-05-07 19:43:41 +0200 |
| commit | b0f9cbb3da6124c540b0a577e0928e85b362b277 (patch) | |
| tree | 770d68dc84dbec1274a358be5bd7b961632d3233 | |
| parent | 263ab750a5963af837fd69647071faa92093011c (diff) | |
| download | emacs-b0f9cbb3da6124c540b0a577e0928e85b362b277.tar.gz emacs-b0f9cbb3da6124c540b0a577e0928e85b362b277.zip | |
Categorize browse-url functions into internal and external ones.
* lisp/net/browse-url.el: Write package documentation explaining
browse-url-browser-kind symbol property. Categorize existing
browse-url functions into internal and external ones.
(browse-url--browser-kind, browse-url--browser-kind-mailto)
(browse-url--browser-kind-man, browse-url--browser-kind-browser): New
functions.
(browse-url-select-handler): Add KIND argument to restrict selection.
* lisp/dnd.el (dnd-handle-one-url): Only select browse-url handler of
kind `internal'.
* lisp/net/eww.el (eww): Add `browse-url-browser-kind' symbol property
with value `internal'.
| -rw-r--r-- | lisp/dnd.el | 2 | ||||
| -rw-r--r-- | lisp/net/browse-url.el | 110 | ||||
| -rw-r--r-- | lisp/net/eww.el | 2 |
3 files changed, 109 insertions, 5 deletions
diff --git a/lisp/dnd.el b/lisp/dnd.el index 102bc752b07..298241bf174 100644 --- a/lisp/dnd.el +++ b/lisp/dnd.el | |||
| @@ -103,7 +103,7 @@ is what has been dropped. Returns ACTION." | |||
| 103 | (catch 'done | 103 | (catch 'done |
| 104 | ;; Autoloaded but the byte-compiler still complains. | 104 | ;; Autoloaded but the byte-compiler still complains. |
| 105 | (declare-function browse-url-select-handler "browse-url" (url)) | 105 | (declare-function browse-url-select-handler "browse-url" (url)) |
| 106 | (let ((browser (browse-url-select-handler url))) | 106 | (let ((browser (browse-url-select-handler url 'internal))) |
| 107 | (when browser | 107 | (when browser |
| 108 | (setq ret 'private) | 108 | (setq ret 'private) |
| 109 | (funcall browser url action) | 109 | (funcall browser url action) |
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 9d7eca72286..6dc9f8961a8 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el | |||
| @@ -119,6 +119,17 @@ | |||
| 119 | ;; could be done by setting `browse-url-browser-function' to an alist | 119 | ;; could be done by setting `browse-url-browser-function' to an alist |
| 120 | ;; but this usage is deprecated now. | 120 | ;; but this usage is deprecated now. |
| 121 | 121 | ||
| 122 | ;; All browser functions provided by here have a | ||
| 123 | ;; `browse-url-browser-kind' symbol property set to either `internal' | ||
| 124 | ;; or `external' which determines if they browse the given URL inside | ||
| 125 | ;; Emacs or spawn an external application with it. Some parts of | ||
| 126 | ;; Emacs make use of that, e.g., when an URL is dragged into Emacs, it | ||
| 127 | ;; is not sensible to invoke an external browser with it, so here only | ||
| 128 | ;; internal browsers are considered. Therefore, it is advised to put | ||
| 129 | ;; that property also on custom browser functions. | ||
| 130 | ;; (put 'my-browse-url-in-emacs 'browse-url-browser-kind 'internal) | ||
| 131 | ;; (put 'my-browse-url-externally 'browse-url-browser-kind 'external) | ||
| 132 | |||
| 122 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 133 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 123 | ;;; Code: | 134 | ;;; Code: |
| 124 | 135 | ||
| @@ -593,18 +604,45 @@ down (this *won't* always work)." | |||
| 593 | "Wrapper command prepended to the Elinks command-line." | 604 | "Wrapper command prepended to the Elinks command-line." |
| 594 | :type '(repeat (string :tag "Wrapper"))) | 605 | :type '(repeat (string :tag "Wrapper"))) |
| 595 | 606 | ||
| 607 | (defun browse-url--browser-kind (function url) | ||
| 608 | "Return the browser kind of a browser FUNCTION for URL. | ||
| 609 | The browser kind is either `internal' (the browser runs inside | ||
| 610 | Emacs), `external' (the browser is spawned in an external | ||
| 611 | process), or nil (we don't know)." | ||
| 612 | (let ((kind (if (symbolp function) | ||
| 613 | (get function 'browse-url-browser-kind)))) | ||
| 614 | (if (functionp kind) | ||
| 615 | (funcall kind url) | ||
| 616 | kind))) | ||
| 617 | |||
| 596 | (defun browse-url--mailto (url &rest args) | 618 | (defun browse-url--mailto (url &rest args) |
| 597 | "Calls `browse-url-mailto-function' with URL and ARGS." | 619 | "Calls `browse-url-mailto-function' with URL and ARGS." |
| 598 | (funcall browse-url-mailto-function url args)) | 620 | (funcall browse-url-mailto-function url args)) |
| 599 | 621 | ||
| 622 | (defun browse-url--browser-kind-mailto (url) | ||
| 623 | (browse-url--browser-kind browse-url-mailto-function url)) | ||
| 624 | (put 'browse-url--mailto 'browse-url-browser-kind | ||
| 625 | #'browse-url--browser-kind-mailto) | ||
| 626 | |||
| 600 | (defun browse-url--man (url &rest args) | 627 | (defun browse-url--man (url &rest args) |
| 601 | "Calls `browse-url-man-function' with URL and ARGS." | 628 | "Calls `browse-url-man-function' with URL and ARGS." |
| 602 | (funcall browse-url-man-function url args)) | 629 | (funcall browse-url-man-function url args)) |
| 603 | 630 | ||
| 631 | (defun browse-url--browser-kind-man (url) | ||
| 632 | (browse-url--browser-kind browse-url-man-function url)) | ||
| 633 | (put 'browse-url--man 'browse-url-browser-kind | ||
| 634 | #'browse-url--browser-kind-man) | ||
| 635 | |||
| 604 | (defun browse-url--browser (url &rest args) | 636 | (defun browse-url--browser (url &rest args) |
| 605 | "Calls `browse-url-browser-function' with URL and ARGS." | 637 | "Calls `browse-url-browser-function' with URL and ARGS." |
| 606 | (funcall browse-url-browser-function url args)) | 638 | (funcall browse-url-browser-function url args)) |
| 607 | 639 | ||
| 640 | (defun browse-url--browser-kind-browser (url) | ||
| 641 | (browse-url--browser-kind browse-url-browser-function url)) | ||
| 642 | (put 'browse-url--browser 'browse-url-browser-kind | ||
| 643 | #'browse-url--browser-kind-browser) | ||
| 644 | |||
| 645 | |||
| 608 | ;;;###autoload | 646 | ;;;###autoload |
| 609 | (defvar browse-url-default-handlers | 647 | (defvar browse-url-default-handlers |
| 610 | '(("\\`mailto:" . browse-url--mailto) | 648 | '(("\\`mailto:" . browse-url--mailto) |
| @@ -636,12 +674,16 @@ match, the URL is opened using the value of | |||
| 636 | :version "28.1") | 674 | :version "28.1") |
| 637 | 675 | ||
| 638 | ;;;###autoload | 676 | ;;;###autoload |
| 639 | (defun browse-url-select-handler (url) | 677 | (defun browse-url-select-handler (url &optional kind) |
| 640 | "Return a handler suitable for browsing URL. | 678 | "Return a handler of suitable for browsing URL. |
| 641 | This searches `browse-url-handlers', and | 679 | This searches `browse-url-handlers', and |
| 642 | `browse-url-default-handlers' for a matching handler. Return nil | 680 | `browse-url-default-handlers' for a matching handler. Return nil |
| 643 | if no handler is found. | 681 | if no handler is found. |
| 644 | 682 | ||
| 683 | If KIND is given, the search is restricted to handlers whose | ||
| 684 | function symbol has the symbol-property `browse-url-browser-kind' | ||
| 685 | set to KIND. | ||
| 686 | |||
| 645 | Currently, it also consults `browse-url-browser-function' first | 687 | Currently, it also consults `browse-url-browser-function' first |
| 646 | if it is set to an alist, although this usage is deprecated since | 688 | if it is set to an alist, although this usage is deprecated since |
| 647 | Emacs 28.1 and will be removed in a future release." | 689 | Emacs 28.1 and will be removed in a future release." |
| @@ -659,7 +701,10 @@ alist is deprecated. Use `browse-url-handlers' instead.") | |||
| 659 | browse-url-browser-function) | 701 | browse-url-browser-function) |
| 660 | browse-url-handlers | 702 | browse-url-handlers |
| 661 | browse-url-default-handlers)) | 703 | browse-url-default-handlers)) |
| 662 | (when (string-match-p (car regex-handler) url) | 704 | (when (and (or (null kind) |
| 705 | (eq kind (browse-url--browser-kind | ||
| 706 | (cdr regex-handler) url))) | ||
| 707 | (string-match-p (car regex-handler) url)) | ||
| 663 | (throw 'custom-url-handler (cdr regex-handler)))))) | 708 | (throw 'custom-url-handler (cdr regex-handler)))))) |
| 664 | 709 | ||
| 665 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 710 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| @@ -930,12 +975,18 @@ The optional NEW-WINDOW argument is not used." | |||
| 930 | (url-unhex-string url) | 975 | (url-unhex-string url) |
| 931 | url))))) | 976 | url))))) |
| 932 | 977 | ||
| 978 | (put 'browse-url-default-windows-browser 'browse-url-browser-kind | ||
| 979 | 'external) | ||
| 980 | |||
| 933 | (defun browse-url-default-macosx-browser (url &optional _new-window) | 981 | (defun browse-url-default-macosx-browser (url &optional _new-window) |
| 934 | "Invoke the macOS system's default Web browser. | 982 | "Invoke the macOS system's default Web browser. |
| 935 | The optional NEW-WINDOW argument is not used." | 983 | The optional NEW-WINDOW argument is not used." |
| 936 | (interactive (browse-url-interactive-arg "URL: ")) | 984 | (interactive (browse-url-interactive-arg "URL: ")) |
| 937 | (start-process (concat "open " url) nil "open" url)) | 985 | (start-process (concat "open " url) nil "open" url)) |
| 938 | 986 | ||
| 987 | (put 'browse-url-default-macosx-browser 'browse-url-browser-kind | ||
| 988 | 'external) | ||
| 989 | |||
| 939 | ;; --- Netscape --- | 990 | ;; --- Netscape --- |
| 940 | 991 | ||
| 941 | (defun browse-url-process-environment () | 992 | (defun browse-url-process-environment () |
| @@ -992,6 +1043,10 @@ instead of `browse-url-new-window-flag'." | |||
| 992 | (lambda (&rest _ignore) (error "No usable browser found")))) | 1043 | (lambda (&rest _ignore) (error "No usable browser found")))) |
| 993 | url args)) | 1044 | url args)) |
| 994 | 1045 | ||
| 1046 | (put 'browse-url-default-browser 'browse-url-browser-kind | ||
| 1047 | ;; Well, most probably external if we ignore w3. | ||
| 1048 | 'external) | ||
| 1049 | |||
| 995 | (defun browse-url-can-use-xdg-open () | 1050 | (defun browse-url-can-use-xdg-open () |
| 996 | "Return non-nil if the \"xdg-open\" program can be used. | 1051 | "Return non-nil if the \"xdg-open\" program can be used. |
| 997 | xdg-open is a desktop utility that calls your preferred web browser." | 1052 | xdg-open is a desktop utility that calls your preferred web browser." |
| @@ -1011,6 +1066,8 @@ The optional argument IGNORED is not used." | |||
| 1011 | (interactive (browse-url-interactive-arg "URL: ")) | 1066 | (interactive (browse-url-interactive-arg "URL: ")) |
| 1012 | (call-process "xdg-open" nil 0 nil url)) | 1067 | (call-process "xdg-open" nil 0 nil url)) |
| 1013 | 1068 | ||
| 1069 | (put 'browse-url-xdg-open 'browse-url-browser-kind 'external) | ||
| 1070 | |||
| 1014 | ;;;###autoload | 1071 | ;;;###autoload |
| 1015 | (defun browse-url-netscape (url &optional new-window) | 1072 | (defun browse-url-netscape (url &optional new-window) |
| 1016 | "Ask the Netscape WWW browser to load URL. | 1073 | "Ask the Netscape WWW browser to load URL. |
| @@ -1054,6 +1111,8 @@ used instead of `browse-url-new-window-flag'." | |||
| 1054 | `(lambda (process change) | 1111 | `(lambda (process change) |
| 1055 | (browse-url-netscape-sentinel process ,url))))) | 1112 | (browse-url-netscape-sentinel process ,url))))) |
| 1056 | 1113 | ||
| 1114 | (put 'browse-url-netscape 'browse-url-browser-kind 'external) | ||
| 1115 | |||
| 1057 | (defun browse-url-netscape-sentinel (process url) | 1116 | (defun browse-url-netscape-sentinel (process url) |
| 1058 | "Handle a change to the process communicating with Netscape." | 1117 | "Handle a change to the process communicating with Netscape." |
| 1059 | (declare (obsolete nil "25.1")) | 1118 | (declare (obsolete nil "25.1")) |
| @@ -1124,6 +1183,8 @@ used instead of `browse-url-new-window-flag'." | |||
| 1124 | `(lambda (process change) | 1183 | `(lambda (process change) |
| 1125 | (browse-url-mozilla-sentinel process ,url))))) | 1184 | (browse-url-mozilla-sentinel process ,url))))) |
| 1126 | 1185 | ||
| 1186 | (put 'browse-url-mozilla 'browse-url-browser-kind 'external) | ||
| 1187 | |||
| 1127 | (defun browse-url-mozilla-sentinel (process url) | 1188 | (defun browse-url-mozilla-sentinel (process url) |
| 1128 | "Handle a change to the process communicating with Mozilla." | 1189 | "Handle a change to the process communicating with Mozilla." |
| 1129 | (or (eq (process-exit-status process) 0) | 1190 | (or (eq (process-exit-status process) 0) |
| @@ -1164,6 +1225,8 @@ instead of `browse-url-new-window-flag'." | |||
| 1164 | '("-new-window"))) | 1225 | '("-new-window"))) |
| 1165 | (list url))))) | 1226 | (list url))))) |
| 1166 | 1227 | ||
| 1228 | (put 'browse-url-firefox 'browse-url-browser-kind 'external) | ||
| 1229 | |||
| 1167 | ;;;###autoload | 1230 | ;;;###autoload |
| 1168 | (defun browse-url-chromium (url &optional _new-window) | 1231 | (defun browse-url-chromium (url &optional _new-window) |
| 1169 | "Ask the Chromium WWW browser to load URL. | 1232 | "Ask the Chromium WWW browser to load URL. |
| @@ -1181,6 +1244,8 @@ The optional argument NEW-WINDOW is not used." | |||
| 1181 | browse-url-chromium-arguments | 1244 | browse-url-chromium-arguments |
| 1182 | (list url))))) | 1245 | (list url))))) |
| 1183 | 1246 | ||
| 1247 | (put 'browse-url-chromium 'browse-url-browser-kind 'external) | ||
| 1248 | |||
| 1184 | (defun browse-url-chrome (url &optional _new-window) | 1249 | (defun browse-url-chrome (url &optional _new-window) |
| 1185 | "Ask the Google Chrome WWW browser to load URL. | 1250 | "Ask the Google Chrome WWW browser to load URL. |
| 1186 | Default to the URL around or before point. The strings in | 1251 | Default to the URL around or before point. The strings in |
| @@ -1197,6 +1262,8 @@ The optional argument NEW-WINDOW is not used." | |||
| 1197 | browse-url-chrome-arguments | 1262 | browse-url-chrome-arguments |
| 1198 | (list url))))) | 1263 | (list url))))) |
| 1199 | 1264 | ||
| 1265 | (put 'browse-url-chrome 'browse-url-browser-kind 'external) | ||
| 1266 | |||
| 1200 | ;;;###autoload | 1267 | ;;;###autoload |
| 1201 | (defun browse-url-galeon (url &optional new-window) | 1268 | (defun browse-url-galeon (url &optional new-window) |
| 1202 | "Ask the Galeon WWW browser to load URL. | 1269 | "Ask the Galeon WWW browser to load URL. |
| @@ -1234,6 +1301,8 @@ used instead of `browse-url-new-window-flag'." | |||
| 1234 | `(lambda (process change) | 1301 | `(lambda (process change) |
| 1235 | (browse-url-galeon-sentinel process ,url))))) | 1302 | (browse-url-galeon-sentinel process ,url))))) |
| 1236 | 1303 | ||
| 1304 | (put 'browse-url-galeon 'browse-url-browser-kind 'external) | ||
| 1305 | |||
| 1237 | (defun browse-url-galeon-sentinel (process url) | 1306 | (defun browse-url-galeon-sentinel (process url) |
| 1238 | "Handle a change to the process communicating with Galeon." | 1307 | "Handle a change to the process communicating with Galeon." |
| 1239 | (declare (obsolete nil "25.1")) | 1308 | (declare (obsolete nil "25.1")) |
| @@ -1280,6 +1349,8 @@ used instead of `browse-url-new-window-flag'." | |||
| 1280 | `(lambda (process change) | 1349 | `(lambda (process change) |
| 1281 | (browse-url-epiphany-sentinel process ,url))))) | 1350 | (browse-url-epiphany-sentinel process ,url))))) |
| 1282 | 1351 | ||
| 1352 | (put 'browse-url-epiphany 'browse-url-browser-kind 'external) | ||
| 1353 | |||
| 1283 | (defun browse-url-epiphany-sentinel (process url) | 1354 | (defun browse-url-epiphany-sentinel (process url) |
| 1284 | "Handle a change to the process communicating with Epiphany." | 1355 | "Handle a change to the process communicating with Epiphany." |
| 1285 | (or (eq (process-exit-status process) 0) | 1356 | (or (eq (process-exit-status process) 0) |
| @@ -1304,6 +1375,8 @@ currently selected window instead." | |||
| 1304 | file-name-handler-alist))) | 1375 | file-name-handler-alist))) |
| 1305 | (if same-window (find-file url) (find-file-other-window url)))) | 1376 | (if same-window (find-file url) (find-file-other-window url)))) |
| 1306 | 1377 | ||
| 1378 | (put 'browse-url-emacs 'browse-url-browser-kind 'internal) | ||
| 1379 | |||
| 1307 | ;;;###autoload | 1380 | ;;;###autoload |
| 1308 | (defun browse-url-gnome-moz (url &optional new-window) | 1381 | (defun browse-url-gnome-moz (url &optional new-window) |
| 1309 | "Ask Mozilla/Netscape to load URL via the GNOME program `gnome-moz-remote'. | 1382 | "Ask Mozilla/Netscape to load URL via the GNOME program `gnome-moz-remote'. |
| @@ -1328,6 +1401,8 @@ used instead of `browse-url-new-window-flag'." | |||
| 1328 | '("--newwin")) | 1401 | '("--newwin")) |
| 1329 | (list "--raise" url)))) | 1402 | (list "--raise" url)))) |
| 1330 | 1403 | ||
| 1404 | (put 'browse-url-gnome-moz 'browse-url-browser-kind 'external) | ||
| 1405 | |||
| 1331 | ;; --- Mosaic --- | 1406 | ;; --- Mosaic --- |
| 1332 | 1407 | ||
| 1333 | ;;;###autoload | 1408 | ;;;###autoload |
| @@ -1379,6 +1454,8 @@ used instead of `browse-url-new-window-flag'." | |||
| 1379 | (append browse-url-mosaic-arguments (list url))) | 1454 | (append browse-url-mosaic-arguments (list url))) |
| 1380 | (message "Starting %s...done" browse-url-mosaic-program)))) | 1455 | (message "Starting %s...done" browse-url-mosaic-program)))) |
| 1381 | 1456 | ||
| 1457 | (put 'browse-url-mosaic 'browse-url-browser-kind 'external) | ||
| 1458 | |||
| 1382 | ;; --- Mosaic using CCI --- | 1459 | ;; --- Mosaic using CCI --- |
| 1383 | 1460 | ||
| 1384 | ;;;###autoload | 1461 | ;;;###autoload |
| @@ -1411,6 +1488,8 @@ used instead of `browse-url-new-window-flag'." | |||
| 1411 | (process-send-string "browse-url" "disconnect\r\n") | 1488 | (process-send-string "browse-url" "disconnect\r\n") |
| 1412 | (delete-process "browse-url")) | 1489 | (delete-process "browse-url")) |
| 1413 | 1490 | ||
| 1491 | (put 'browse-url-cci 'browse-url-browser-kind 'external) | ||
| 1492 | |||
| 1414 | ;; --- Conkeror --- | 1493 | ;; --- Conkeror --- |
| 1415 | ;;;###autoload | 1494 | ;;;###autoload |
| 1416 | (defun browse-url-conkeror (url &optional new-window) | 1495 | (defun browse-url-conkeror (url &optional new-window) |
| @@ -1447,6 +1526,9 @@ NEW-WINDOW instead of `browse-url-new-window-flag'." | |||
| 1447 | "window") | 1526 | "window") |
| 1448 | "buffer") | 1527 | "buffer") |
| 1449 | url)))))) | 1528 | url)))))) |
| 1529 | |||
| 1530 | (put 'browse-url-conkeror 'browse-url-browser-kind 'external) | ||
| 1531 | |||
| 1450 | ;; --- W3 --- | 1532 | ;; --- W3 --- |
| 1451 | 1533 | ||
| 1452 | ;; External. | 1534 | ;; External. |
| @@ -1470,6 +1552,8 @@ used instead of `browse-url-new-window-flag'." | |||
| 1470 | (w3-fetch-other-window url) | 1552 | (w3-fetch-other-window url) |
| 1471 | (w3-fetch url))) | 1553 | (w3-fetch url))) |
| 1472 | 1554 | ||
| 1555 | (put 'browse-url-w3 'browse-url-browser-kind 'internal) | ||
| 1556 | |||
| 1473 | ;;;###autoload | 1557 | ;;;###autoload |
| 1474 | (defun browse-url-w3-gnudoit (url &optional _new-window) | 1558 | (defun browse-url-w3-gnudoit (url &optional _new-window) |
| 1475 | ;; new-window ignored | 1559 | ;; new-window ignored |
| @@ -1484,6 +1568,8 @@ The `browse-url-gnudoit-program' program is used with options given by | |||
| 1484 | (list (concat "(w3-fetch \"" url "\")") | 1568 | (list (concat "(w3-fetch \"" url "\")") |
| 1485 | "(raise-frame)")))) | 1569 | "(raise-frame)")))) |
| 1486 | 1570 | ||
| 1571 | (put 'browse-url-w3-gnudoit 'browse-url-browser-kind 'internal) | ||
| 1572 | |||
| 1487 | ;; --- Lynx in an xterm --- | 1573 | ;; --- Lynx in an xterm --- |
| 1488 | 1574 | ||
| 1489 | ;;;###autoload | 1575 | ;;;###autoload |
| @@ -1501,6 +1587,8 @@ The optional argument NEW-WINDOW is not used." | |||
| 1501 | ,@browse-url-xterm-args "-e" ,browse-url-text-browser | 1587 | ,@browse-url-xterm-args "-e" ,browse-url-text-browser |
| 1502 | ,url))) | 1588 | ,url))) |
| 1503 | 1589 | ||
| 1590 | (put 'browse-url-text-xterm 'browse-url-browser-kind 'external) | ||
| 1591 | |||
| 1504 | ;; --- Lynx in an Emacs "term" window --- | 1592 | ;; --- Lynx in an Emacs "term" window --- |
| 1505 | 1593 | ||
| 1506 | (declare-function term-char-mode "term" ()) | 1594 | (declare-function term-char-mode "term" ()) |
| @@ -1575,6 +1663,8 @@ used instead of `browse-url-new-window-flag'." | |||
| 1575 | url | 1663 | url |
| 1576 | "\r"))))) | 1664 | "\r"))))) |
| 1577 | 1665 | ||
| 1666 | (put 'browse-url-text-emacs 'browse-url-browser-kind 'internal) | ||
| 1667 | |||
| 1578 | ;; --- mailto --- | 1668 | ;; --- mailto --- |
| 1579 | 1669 | ||
| 1580 | (autoload 'rfc2368-parse-mailto-url "rfc2368") | 1670 | (autoload 'rfc2368-parse-mailto-url "rfc2368") |
| @@ -1622,6 +1712,8 @@ used instead of `browse-url-new-window-flag'." | |||
| 1622 | (unless (bolp) | 1712 | (unless (bolp) |
| 1623 | (insert "\n")))))))) | 1713 | (insert "\n")))))))) |
| 1624 | 1714 | ||
| 1715 | (put 'browse-url-mail 'browse-url-browser-kind 'internal) | ||
| 1716 | |||
| 1625 | ;; --- man --- | 1717 | ;; --- man --- |
| 1626 | 1718 | ||
| 1627 | (defvar manual-program) | 1719 | (defvar manual-program) |
| @@ -1633,7 +1725,9 @@ used instead of `browse-url-new-window-flag'." | |||
| 1633 | (setq url (replace-regexp-in-string "\\`man:" "" url)) | 1725 | (setq url (replace-regexp-in-string "\\`man:" "" url)) |
| 1634 | (cond | 1726 | (cond |
| 1635 | ((executable-find manual-program) (man url)) | 1727 | ((executable-find manual-program) (man url)) |
| 1636 | (t (woman (replace-regexp-in-string "([[:alnum:]]+)" "" url))))) | 1728 | (t (woman (replace-regexp-in-string "([[:alnum:]]+)" "" url))))) |
| 1729 | |||
| 1730 | (put 'browse-url-man 'browse-url-browser-kind 'internal) | ||
| 1637 | 1731 | ||
| 1638 | ;; --- Random browser --- | 1732 | ;; --- Random browser --- |
| 1639 | 1733 | ||
| @@ -1652,6 +1746,8 @@ don't offer a form of remote control." | |||
| 1652 | 0 nil | 1746 | 0 nil |
| 1653 | (append browse-url-generic-args (list url)))) | 1747 | (append browse-url-generic-args (list url)))) |
| 1654 | 1748 | ||
| 1749 | (put 'browse-url-generic 'browse-url-browser-kind 'external) | ||
| 1750 | |||
| 1655 | ;;;###autoload | 1751 | ;;;###autoload |
| 1656 | (defun browse-url-kde (url &optional _new-window) | 1752 | (defun browse-url-kde (url &optional _new-window) |
| 1657 | "Ask the KDE WWW browser to load URL. | 1753 | "Ask the KDE WWW browser to load URL. |
| @@ -1662,6 +1758,8 @@ The optional argument NEW-WINDOW is not used." | |||
| 1662 | (apply #'start-process (concat "KDE " url) nil browse-url-kde-program | 1758 | (apply #'start-process (concat "KDE " url) nil browse-url-kde-program |
| 1663 | (append browse-url-kde-args (list url)))) | 1759 | (append browse-url-kde-args (list url)))) |
| 1664 | 1760 | ||
| 1761 | (put 'browse-url-kde 'browse-url-browser-kind 'external) | ||
| 1762 | |||
| 1665 | (defun browse-url-elinks-new-window (url) | 1763 | (defun browse-url-elinks-new-window (url) |
| 1666 | "Ask the Elinks WWW browser to load URL in a new window." | 1764 | "Ask the Elinks WWW browser to load URL in a new window." |
| 1667 | (let ((process-environment (browse-url-process-environment))) | 1765 | (let ((process-environment (browse-url-process-environment))) |
| @@ -1671,6 +1769,8 @@ The optional argument NEW-WINDOW is not used." | |||
| 1671 | browse-url-elinks-wrapper | 1769 | browse-url-elinks-wrapper |
| 1672 | (list "elinks" url))))) | 1770 | (list "elinks" url))))) |
| 1673 | 1771 | ||
| 1772 | (put 'browse-url-elinks-new-window 'browse-url-browser-kind 'external) | ||
| 1773 | |||
| 1674 | ;;;###autoload | 1774 | ;;;###autoload |
| 1675 | (defun browse-url-elinks (url &optional new-window) | 1775 | (defun browse-url-elinks (url &optional new-window) |
| 1676 | "Ask the Elinks WWW browser to load URL. | 1776 | "Ask the Elinks WWW browser to load URL. |
| @@ -1692,6 +1792,8 @@ from `browse-url-elinks-wrapper'." | |||
| 1692 | `(lambda (process change) | 1792 | `(lambda (process change) |
| 1693 | (browse-url-elinks-sentinel process ,url)))))) | 1793 | (browse-url-elinks-sentinel process ,url)))))) |
| 1694 | 1794 | ||
| 1795 | (put 'browse-url-elinks 'browse-url-browser-kind 'external) | ||
| 1796 | |||
| 1695 | (defun browse-url-elinks-sentinel (process url) | 1797 | (defun browse-url-elinks-sentinel (process url) |
| 1696 | "Determines if Elinks is running or a new one has to be started." | 1798 | "Determines if Elinks is running or a new one has to be started." |
| 1697 | ;; Try to determine if an instance is running or if we have to | 1799 | ;; Try to determine if an instance is running or if we have to |
diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 9cf9ecea0bf..a6c1abdbb19 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el | |||
| @@ -310,6 +310,8 @@ the default EWW buffer." | |||
| 310 | (url-retrieve url 'eww-render | 310 | (url-retrieve url 'eww-render |
| 311 | (list url nil (current-buffer))))) | 311 | (list url nil (current-buffer))))) |
| 312 | 312 | ||
| 313 | (put 'eww 'browse-url-browser-kind 'internal) | ||
| 314 | |||
| 313 | (defun eww--dwim-expand-url (url) | 315 | (defun eww--dwim-expand-url (url) |
| 314 | (setq url (string-trim url)) | 316 | (setq url (string-trim url)) |
| 315 | (cond ((string-match-p "\\`file:/" url)) | 317 | (cond ((string-match-p "\\`file:/" url)) |