diff options
| author | Richard M. Stallman | 2003-07-07 20:54:56 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-07-07 20:54:56 +0000 |
| commit | 654805e39d5ea62a3dba5b516655cb6a412110ed (patch) | |
| tree | aa6d32a5c7f1094fecc7e1f5173d8049223c2051 | |
| parent | c72095b34528879ce56d5b484ecda9e0f72885ac (diff) | |
| download | emacs-654805e39d5ea62a3dba5b516655cb6a412110ed.tar.gz emacs-654805e39d5ea62a3dba5b516655cb6a412110ed.zip | |
(browse-url-browser-function): Add alternative for Epiphany.
(browse-url-epiphany-program, browse-url-epiphany-arguments)
(browse-url-epiphany-startup-arguments)
(browse-url-epiphany-new-window-is-tab): New variables.
(browse-url-epiphany, browse-url-epiphany-sentinel): New functions.
| -rw-r--r-- | lisp/net/browse-url.el | 78 |
1 files changed, 77 insertions, 1 deletions
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index bc8dcaa5f42..895ab12282f 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | ;; Function Browser Earliest version | 39 | ;; Function Browser Earliest version |
| 40 | ;; browse-url-mozilla Mozilla Don't know | 40 | ;; browse-url-mozilla Mozilla Don't know |
| 41 | ;; browse-url-galeon Galeon Don't know | 41 | ;; browse-url-galeon Galeon Don't know |
| 42 | ;; browse-url-epiphany Epiphany Don't know | ||
| 42 | ;; browse-url-netscape Netscape 1.1b1 | 43 | ;; browse-url-netscape Netscape 1.1b1 |
| 43 | ;; browse-url-mosaic XMosaic/mMosaic <= 2.4 | 44 | ;; browse-url-mosaic XMosaic/mMosaic <= 2.4 |
| 44 | ;; browse-url-cci XMosaic 2.5 | 45 | ;; browse-url-cci XMosaic 2.5 |
| @@ -248,6 +249,7 @@ regexp should probably be \".\" to specify a default browser." | |||
| 248 | :value browse-url-w3-gnudoit) | 249 | :value browse-url-w3-gnudoit) |
| 249 | (function-item :tag "Mozilla" :value browse-url-mozilla) | 250 | (function-item :tag "Mozilla" :value browse-url-mozilla) |
| 250 | (function-item :tag "Galeon" :value browse-url-galeon) | 251 | (function-item :tag "Galeon" :value browse-url-galeon) |
| 252 | (function-item :tag "Epiphany" :value browse-url-epiphany) | ||
| 251 | (function-item :tag "Netscape" :value browse-url-netscape) | 253 | (function-item :tag "Netscape" :value browse-url-netscape) |
| 252 | (function-item :tag "Mosaic" :value browse-url-mosaic) | 254 | (function-item :tag "Mosaic" :value browse-url-mosaic) |
| 253 | (function-item :tag "Mosaic using CCI" :value browse-url-cci) | 255 | (function-item :tag "Mosaic using CCI" :value browse-url-cci) |
| @@ -338,6 +340,23 @@ Defaults to the value of `browse-url-galeon-arguments' at the time | |||
| 338 | :type '(repeat (string :tag "Argument")) | 340 | :type '(repeat (string :tag "Argument")) |
| 339 | :group 'browse-url) | 341 | :group 'browse-url) |
| 340 | 342 | ||
| 343 | (defcustom browse-url-epiphany-program "epiphany" | ||
| 344 | "*The name by which to invoke Epiphany." | ||
| 345 | :type 'string | ||
| 346 | :group 'browse-url) | ||
| 347 | |||
| 348 | (defcustom browse-url-epiphany-arguments nil | ||
| 349 | "*A list of strings to pass to Epiphany as arguments." | ||
| 350 | :type '(repeat (string :tag "Argument")) | ||
| 351 | :group 'browse-url) | ||
| 352 | |||
| 353 | (defcustom browse-url-epiphany-startup-arguments browse-url-epiphany-arguments | ||
| 354 | "*A list of strings to pass to Epiphany when it starts up. | ||
| 355 | Defaults to the value of `browse-url-epiphany-arguments' at the time | ||
| 356 | `browse-url' is loaded." | ||
| 357 | :type '(repeat (string :tag "Argument")) | ||
| 358 | :group 'browse-url) | ||
| 359 | |||
| 341 | (defcustom browse-url-mozilla-new-window-is-tab nil | 360 | (defcustom browse-url-mozilla-new-window-is-tab nil |
| 342 | "*Whether to open up new windows in a tab or a new window. | 361 | "*Whether to open up new windows in a tab or a new window. |
| 343 | If non-nil, then open the URL in a new tab rather than a new window if | 362 | If non-nil, then open the URL in a new tab rather than a new window if |
| @@ -352,6 +371,13 @@ If non-nil, then open the URL in a new tab rather than a new window if | |||
| 352 | :type 'boolean | 371 | :type 'boolean |
| 353 | :group 'browse-url) | 372 | :group 'browse-url) |
| 354 | 373 | ||
| 374 | (defcustom browse-url-epiphany-new-window-is-tab nil | ||
| 375 | "*Whether to open up new windows in a tab or a new window. | ||
| 376 | If non-nil, then open the URL in a new tab rather than a new window if | ||
| 377 | `browse-url-epiphany' is asked to open it in a new window." | ||
| 378 | :type 'boolean | ||
| 379 | :group 'browse-url) | ||
| 380 | |||
| 355 | (defcustom browse-url-new-window-flag nil | 381 | (defcustom browse-url-new-window-flag nil |
| 356 | "*If non-nil, always open a new browser window with appropriate browsers. | 382 | "*If non-nil, always open a new browser window with appropriate browsers. |
| 357 | Passing an interactive argument to \\[browse-url], or specific browser | 383 | Passing an interactive argument to \\[browse-url], or specific browser |
| @@ -922,7 +948,8 @@ used instead of `browse-url-new-window-flag'." | |||
| 922 | (format "%%%x" (string-to-char (match-string 0 url))) t t url))) | 948 | (format "%%%x" (string-to-char (match-string 0 url))) t t url))) |
| 923 | (let* ((process-environment (browse-url-process-environment)) | 949 | (let* ((process-environment (browse-url-process-environment)) |
| 924 | (process (apply 'start-process | 950 | (process (apply 'start-process |
| 925 | (concat "galeon " url) nil | 951 | (concat "galeon " url) |
| 952 | nil | ||
| 926 | browse-url-galeon-program | 953 | browse-url-galeon-program |
| 927 | (append | 954 | (append |
| 928 | browse-url-galeon-arguments | 955 | browse-url-galeon-arguments |
| @@ -946,6 +973,55 @@ used instead of `browse-url-new-window-flag'." | |||
| 946 | browse-url-galeon-program | 973 | browse-url-galeon-program |
| 947 | (append browse-url-galeon-startup-arguments (list url)))))) | 974 | (append browse-url-galeon-startup-arguments (list url)))))) |
| 948 | 975 | ||
| 976 | (defun browse-url-epiphany (url &optional new-window) | ||
| 977 | "Ask the Epiphany WWW browser to load URL. | ||
| 978 | Default to the URL around or before point. The strings in variable | ||
| 979 | `browse-url-galeon-arguments' are also passed to Epiphany. | ||
| 980 | |||
| 981 | When called interactively, if variable `browse-url-new-window-flag' is | ||
| 982 | non-nil, load the document in a new Epiphany window, otherwise use a | ||
| 983 | random existing one. A non-nil interactive prefix argument reverses | ||
| 984 | the effect of `browse-url-new-window-flag'. | ||
| 985 | |||
| 986 | If `browse-url-galeon-new-window-is-tab' is non-nil, then whenever a | ||
| 987 | document would otherwise be loaded in a new window, it is loaded in a | ||
| 988 | new tab in an existing window instead. | ||
| 989 | |||
| 990 | When called non-interactively, optional second argument NEW-WINDOW is | ||
| 991 | used instead of `browse-url-new-window-flag'." | ||
| 992 | (interactive (browse-url-interactive-arg "URL: ")) | ||
| 993 | ;; URL encode any `confusing' characters in the URL. This needs to | ||
| 994 | ;; include at least commas; presumably also close parens. | ||
| 995 | (while (string-match "[,)]" url) | ||
| 996 | (setq url (replace-match | ||
| 997 | (format "%%%x" (string-to-char (match-string 0 url))) t t url))) | ||
| 998 | (let* ((process-environment (browse-url-process-environment)) | ||
| 999 | (process (apply 'start-process | ||
| 1000 | (concat "epiphany " url) | ||
| 1001 | nil | ||
| 1002 | browse-url-epiphany-program | ||
| 1003 | (append | ||
| 1004 | browse-url-epiphany-arguments | ||
| 1005 | (if (browse-url-maybe-new-window new-window) | ||
| 1006 | (if browse-url-epiphany-new-window-is-tab | ||
| 1007 | '("--new-tab") | ||
| 1008 | '("--new-window" "--noraise")) | ||
| 1009 | '("--existing")) | ||
| 1010 | (list url))))) | ||
| 1011 | (set-process-sentinel process | ||
| 1012 | `(lambda (process change) | ||
| 1013 | (browse-url-epiphany-sentinel process ,url))))) | ||
| 1014 | |||
| 1015 | (defun browse-url-epiphany-sentinel (process url) | ||
| 1016 | "Handle a change to the process communicating with Epiphany." | ||
| 1017 | (or (eq (process-exit-status process) 0) | ||
| 1018 | (let* ((process-environment (browse-url-process-environment))) | ||
| 1019 | ;; Epiphany is not running - start it | ||
| 1020 | (message "Starting Epiphany...") | ||
| 1021 | (apply 'start-process (concat "epiphany " url) nil | ||
| 1022 | browse-url-epiphany-program | ||
| 1023 | (append browse-url-epiphany-startup-arguments (list url)))))) | ||
| 1024 | |||
| 949 | ;; GNOME means of invoking either Mozilla or Netrape. | 1025 | ;; GNOME means of invoking either Mozilla or Netrape. |
| 950 | (defvar browse-url-gnome-moz-program "gnome-moz-remote") | 1026 | (defvar browse-url-gnome-moz-program "gnome-moz-remote") |
| 951 | (defcustom browse-url-gnome-moz-arguments '() | 1027 | (defcustom browse-url-gnome-moz-arguments '() |