diff options
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/net/browse-url.el | 103 |
2 files changed, 109 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 95eb89e5fd3..a800d4308bc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2005-03-18 Steve Youngs <steve@xemacs.org> | ||
| 2 | |||
| 3 | * net/browse-url.el (browse-url-browser-function) | ||
| 4 | (browse-url-default-browser): Add firefox. | ||
| 5 | (browse-url-firefox-program, browse-url-firefox-arguments) | ||
| 6 | (browse-url-firefox-startup-arguments) | ||
| 7 | (browse-url-firefox-new-window-is-tab): New defcustoms. | ||
| 8 | (browse-url-firefox, browse-url-firefox-sentinel): New functions. | ||
| 9 | |||
| 1 | 2005-06-17 Richard M. Stallman <rms@gnu.org> | 10 | 2005-06-17 Richard M. Stallman <rms@gnu.org> |
| 2 | 11 | ||
| 3 | * startup.el (command-line): Warn if specified user name has | 12 | * startup.el (command-line): Warn if specified user name has |
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index d846234133d..70388e56ab7 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | 38 | ||
| 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-firefox Firefox Don't know (tried with 1.0.1) | ||
| 41 | ;; browse-url-galeon Galeon Don't know | 42 | ;; browse-url-galeon Galeon Don't know |
| 42 | ;; browse-url-epiphany Epiphany Don't know | 43 | ;; browse-url-epiphany Epiphany Don't know |
| 43 | ;; browse-url-netscape Netscape 1.1b1 | 44 | ;; browse-url-netscape Netscape 1.1b1 |
| @@ -248,6 +249,7 @@ regexp should probably be \".\" to specify a default browser." | |||
| 248 | (function-item :tag "W3 in another Emacs via `gnudoit'" | 249 | (function-item :tag "W3 in another Emacs via `gnudoit'" |
| 249 | :value browse-url-w3-gnudoit) | 250 | :value browse-url-w3-gnudoit) |
| 250 | (function-item :tag "Mozilla" :value browse-url-mozilla) | 251 | (function-item :tag "Mozilla" :value browse-url-mozilla) |
| 252 | (function-item :tag "Firefox" :value browse-url-firefox) | ||
| 251 | (function-item :tag "Galeon" :value browse-url-galeon) | 253 | (function-item :tag "Galeon" :value browse-url-galeon) |
| 252 | (function-item :tag "Epiphany" :value browse-url-epiphany) | 254 | (function-item :tag "Epiphany" :value browse-url-epiphany) |
| 253 | (function-item :tag "Netscape" :value browse-url-netscape) | 255 | (function-item :tag "Netscape" :value browse-url-netscape) |
| @@ -323,6 +325,25 @@ Defaults to the value of `browse-url-mozilla-arguments' at the time | |||
| 323 | :type '(repeat (string :tag "Argument")) | 325 | :type '(repeat (string :tag "Argument")) |
| 324 | :group 'browse-url) | 326 | :group 'browse-url) |
| 325 | 327 | ||
| 328 | ;;;###autoload | ||
| 329 | (defcustom browse-url-firefox-program "firefox" | ||
| 330 | "*The name by which to invoke Firefox." | ||
| 331 | :type 'string | ||
| 332 | :group 'browse-url) | ||
| 333 | |||
| 334 | (defcustom browse-url-firefox-arguments nil | ||
| 335 | "*A list of strings to pass to Firefox as arguments." | ||
| 336 | :type '(repeat (string :tag "Argument")) | ||
| 337 | :group 'browse-url) | ||
| 338 | |||
| 339 | (defcustom browse-url-firefox-startup-arguments browse-url-firefox-arguments | ||
| 340 | "*A list of strings to pass to Firefox when it starts up. | ||
| 341 | Defaults to the value of `browse-url-firefox-arguments' at the time | ||
| 342 | `browse-url' is loaded." | ||
| 343 | :type '(repeat (string :tag "Argument")) | ||
| 344 | :group 'browse-url) | ||
| 345 | |||
| 346 | ;;;###autoload | ||
| 326 | (defcustom browse-url-galeon-program "galeon" | 347 | (defcustom browse-url-galeon-program "galeon" |
| 327 | "*The name by which to invoke Galeon." | 348 | "*The name by which to invoke Galeon." |
| 328 | :type 'string | 349 | :type 'string |
| @@ -373,6 +394,16 @@ If non-nil, then open the URL in a new tab rather than a new window if | |||
| 373 | :type 'boolean | 394 | :type 'boolean |
| 374 | :group 'browse-url) | 395 | :group 'browse-url) |
| 375 | 396 | ||
| 397 | (defcustom browse-url-firefox-new-window-is-tab nil | ||
| 398 | "*Whether to open up new windows in a tab or a new window. | ||
| 399 | If non-nil, then open the URL in a new tab rather than a new window if | ||
| 400 | `browse-url-firefox' is asked to open it in a new window. | ||
| 401 | |||
| 402 | This option is currently ignored on MS-Windows, since the necessary | ||
| 403 | functionality is not available there." | ||
| 404 | :type 'boolean | ||
| 405 | :group 'browse-url) | ||
| 406 | |||
| 376 | (defcustom browse-url-galeon-new-window-is-tab nil | 407 | (defcustom browse-url-galeon-new-window-is-tab nil |
| 377 | "*Whether to open up new windows in a tab or a new window. | 408 | "*Whether to open up new windows in a tab or a new window. |
| 378 | If non-nil, then open the URL in a new tab rather than a new window if | 409 | If non-nil, then open the URL in a new tab rather than a new window if |
| @@ -815,13 +846,14 @@ the effect of `browse-url-new-window-flag'. | |||
| 815 | When called non-interactively, optional second argument NEW-WINDOW is | 846 | When called non-interactively, optional second argument NEW-WINDOW is |
| 816 | used instead of `browse-url-new-window-flag'. | 847 | used instead of `browse-url-new-window-flag'. |
| 817 | 848 | ||
| 818 | The order attempted is gnome-moz-remote, Mozilla, Galeon, | 849 | The order attempted is gnome-moz-remote, Mozilla, Firefox, |
| 819 | Konqueror, Netscape, Mosaic, IXI Mosaic, Lynx in an xterm, MMM, | 850 | Galeon, Konqueror, Netscape, Mosaic, IXI Mosaic, Lynx in an |
| 820 | and then W3." | 851 | xterm, MMM, and then W3." |
| 821 | (apply | 852 | (apply |
| 822 | (cond | 853 | (cond |
| 823 | ((executable-find browse-url-gnome-moz-program) 'browse-url-gnome-moz) | 854 | ((executable-find browse-url-gnome-moz-program) 'browse-url-gnome-moz) |
| 824 | ((executable-find browse-url-mozilla-program) 'browse-url-mozilla) | 855 | ((executable-find browse-url-mozilla-program) 'browse-url-mozilla) |
| 856 | ((executable-find browse-url-firefox-program) 'browse-url-firefox) | ||
| 825 | ((executable-find browse-url-galeon-program) 'browse-url-galeon) | 857 | ((executable-find browse-url-galeon-program) 'browse-url-galeon) |
| 826 | ((executable-find browse-url-kde-program) 'browse-url-kde) | 858 | ((executable-find browse-url-kde-program) 'browse-url-kde) |
| 827 | ((executable-find browse-url-netscape-program) 'browse-url-netscape) | 859 | ((executable-find browse-url-netscape-program) 'browse-url-netscape) |
| @@ -960,6 +992,71 @@ used instead of `browse-url-new-window-flag'." | |||
| 960 | (append browse-url-mozilla-startup-arguments (list url)))))) | 992 | (append browse-url-mozilla-startup-arguments (list url)))))) |
| 961 | 993 | ||
| 962 | ;;;###autoload | 994 | ;;;###autoload |
| 995 | (defun browse-url-firefox (url &optional new-window) | ||
| 996 | "Ask the Firefox WWW browser to load URL. | ||
| 997 | Default to the URL around or before point. The strings in | ||
| 998 | variable `browse-url-firefox-arguments' are also passed to | ||
| 999 | Firefox. | ||
| 1000 | |||
| 1001 | When called interactively, if variable | ||
| 1002 | `browse-url-new-window-flag' is non-nil, load the document in a | ||
| 1003 | new Firefox window, otherwise use a random existing one. A | ||
| 1004 | non-nil interactive prefix argument reverses the effect of | ||
| 1005 | `browse-url-new-window-flag'. | ||
| 1006 | |||
| 1007 | If `browse-url-firefox-new-window-is-tab' is non-nil, then | ||
| 1008 | whenever a document would otherwise be loaded in a new window, it | ||
| 1009 | is loaded in a new tab in an existing window instead. | ||
| 1010 | |||
| 1011 | When called non-interactively, optional second argument | ||
| 1012 | NEW-WINDOW is used instead of `browse-url-new-window-flag'. | ||
| 1013 | |||
| 1014 | On MS-Windows systems the optional `new-window' parameter is | ||
| 1015 | ignored. Firefox for Windows does not support the \"-remote\" | ||
| 1016 | command line parameter. Therefore, the | ||
| 1017 | `browse-url-new-window-flag' and `browse-url-firefox-new-window-is-tab' | ||
| 1018 | are ignored as well. Firefox on Windows will always open the requested | ||
| 1019 | URL in a new window." | ||
| 1020 | (interactive (browse-url-interactive-arg "URL: ")) | ||
| 1021 | ;; URL encode any `confusing' characters in the URL. This needs to | ||
| 1022 | ;; include at least commas; presumably also close parens. | ||
| 1023 | (while (string-match "[,)]" url) | ||
| 1024 | (setq url (replace-match | ||
| 1025 | (format "%%%x" (string-to-char (match-string 0 url))) t t url))) | ||
| 1026 | (let* ((process-environment (browse-url-process-environment)) | ||
| 1027 | (process | ||
| 1028 | (apply 'start-process | ||
| 1029 | (concat "firefox " url) nil | ||
| 1030 | browse-url-firefox-program | ||
| 1031 | (append | ||
| 1032 | browse-url-firefox-arguments | ||
| 1033 | (if (or (featurep 'dos-w32) | ||
| 1034 | (string-match "win32" system-configuration)) | ||
| 1035 | (list url) | ||
| 1036 | (list "-remote" | ||
| 1037 | (concat "openURL(" | ||
| 1038 | url | ||
| 1039 | (if (browse-url-maybe-new-window | ||
| 1040 | new-window) | ||
| 1041 | (if browse-url-firefox-new-window-is-tab | ||
| 1042 | ",new-tab" | ||
| 1043 | ",new-window")) | ||
| 1044 | ")"))))))) | ||
| 1045 | (set-process-sentinel process | ||
| 1046 | `(lambda (process change) | ||
| 1047 | (browse-url-firefox-sentinel process ,url))))) | ||
| 1048 | |||
| 1049 | (defun browse-url-firefox-sentinel (process url) | ||
| 1050 | "Handle a change to the process communicating with Firefox." | ||
| 1051 | (or (eq (process-exit-status process) 0) | ||
| 1052 | (let* ((process-environment (browse-url-process-environment))) | ||
| 1053 | ;; Firefox is not running - start it | ||
| 1054 | (message "Starting Firefox...") | ||
| 1055 | (apply 'start-process (concat "firefox " url) nil | ||
| 1056 | browse-url-firefox-program | ||
| 1057 | (append browse-url-firefox-startup-arguments (list url)))))) | ||
| 1058 | |||
| 1059 | ;;;###autoload | ||
| 963 | (defun browse-url-galeon (url &optional new-window) | 1060 | (defun browse-url-galeon (url &optional new-window) |
| 964 | "Ask the Galeon WWW browser to load URL. | 1061 | "Ask the Galeon WWW browser to load URL. |
| 965 | Default to the URL around or before point. The strings in variable | 1062 | Default to the URL around or before point. The strings in variable |