Mercurial > emacs
comparison lisp/net/browse-url.el @ 60208:84bb59b0b21d
(browse-url-netscape-new-window-is-tab): New variable.
(browse-url-netscape): Use it. Suggested by "Johann 'Myrkraverk'
Oskarsson" <myrkraverk@users.sourceforget.net>.
author | Simon Josefsson <jas@extundo.com> |
---|---|
date | Tue, 22 Feb 2005 14:11:25 +0000 |
parents | 48de6e40fcfc |
children | 5c3e9736e532 bf0d492ea2d5 |
comparison
equal
deleted
inserted
replaced
60207:256e23b599d4 | 60208:84bb59b0b21d |
---|---|
1 ;;; browse-url.el --- pass a URL to a WWW browser | 1 ;;; browse-url.el --- pass a URL to a WWW browser |
2 | 2 |
3 ;; Copyright (C) 1995, 96, 97, 98, 99, 2000, 2001, 2004 | 3 ;; Copyright (C) 1995, 96, 97, 98, 99, 2000, 2001, 2004, 2005 |
4 ;; Free Software Foundation, Inc. | 4 ;; Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: Denis Howe <dbh@doc.ic.ac.uk> | 6 ;; Author: Denis Howe <dbh@doc.ic.ac.uk> |
7 ;; Maintainer: FSF | 7 ;; Maintainer: FSF |
8 ;; Created: 03 Apr 1995 | 8 ;; Created: 03 Apr 1995 |
385 If non-nil, then open the URL in a new tab rather than a new window if | 385 If non-nil, then open the URL in a new tab rather than a new window if |
386 `browse-url-epiphany' is asked to open it in a new window." | 386 `browse-url-epiphany' is asked to open it in a new window." |
387 :type 'boolean | 387 :type 'boolean |
388 :group 'browse-url) | 388 :group 'browse-url) |
389 | 389 |
390 (defcustom browse-url-netscape-new-window-is-tab nil | |
391 "*Whether to open up new windows in a tab or a new window. | |
392 If non-nil, then open the URL in a new tab rather than a new | |
393 window if `browse-url-netscape' is asked to open it in a new | |
394 window." | |
395 :type 'boolean | |
396 :group 'browse-url) | |
397 | |
390 (defcustom browse-url-new-window-flag nil | 398 (defcustom browse-url-new-window-flag nil |
391 "*If non-nil, always open a new browser window with appropriate browsers. | 399 "*If non-nil, always open a new browser window with appropriate browsers. |
392 Passing an interactive argument to \\[browse-url], or specific browser | 400 Passing an interactive argument to \\[browse-url], or specific browser |
393 commands reverses the effect of this variable. Requires Netscape version | 401 commands reverses the effect of this variable. Requires Netscape version |
394 1.1N or later or XMosaic version 2.5 or later if using those browsers." | 402 1.1N or later or XMosaic version 2.5 or later if using those browsers." |
832 When called interactively, if variable `browse-url-new-window-flag' is | 840 When called interactively, if variable `browse-url-new-window-flag' is |
833 non-nil, load the document in a new Netscape window, otherwise use a | 841 non-nil, load the document in a new Netscape window, otherwise use a |
834 random existing one. A non-nil interactive prefix argument reverses | 842 random existing one. A non-nil interactive prefix argument reverses |
835 the effect of `browse-url-new-window-flag'. | 843 the effect of `browse-url-new-window-flag'. |
836 | 844 |
845 If `browse-url-netscape-new-window-is-tab' is non-nil, then | |
846 whenever a document would otherwise be loaded in a new window, it | |
847 is loaded in a new tab in an existing window instead. | |
848 | |
837 When called non-interactively, optional second argument NEW-WINDOW is | 849 When called non-interactively, optional second argument NEW-WINDOW is |
838 used instead of `browse-url-new-window-flag'." | 850 used instead of `browse-url-new-window-flag'." |
839 (interactive (browse-url-interactive-arg "URL: ")) | 851 (interactive (browse-url-interactive-arg "URL: ")) |
840 ;; URL encode any `confusing' characters in the URL. This needs to | 852 ;; URL encode any `confusing' characters in the URL. This needs to |
841 ;; include at least commas; presumably also close parens and dollars. | 853 ;; include at least commas; presumably also close parens and dollars. |
842 (while (string-match "[,)$]" url) | 854 (while (string-match "[,)$]" url) |
843 (setq url (replace-match | 855 (setq url (replace-match |
844 (format "%%%x" (string-to-char (match-string 0 url))) t t url))) | 856 (format "%%%x" (string-to-char (match-string 0 url))) t t url))) |
845 (let* ((process-environment (browse-url-process-environment)) | 857 (let* ((process-environment (browse-url-process-environment)) |
846 (process (apply 'start-process | 858 (process |
847 (concat "netscape " url) nil | 859 (apply 'start-process |
848 browse-url-netscape-program | 860 (concat "netscape " url) nil |
849 (append | 861 browse-url-netscape-program |
850 browse-url-netscape-arguments | 862 (append |
851 (if (eq window-system 'w32) | 863 browse-url-netscape-arguments |
852 (list url) | 864 (if (eq window-system 'w32) |
853 (append | 865 (list url) |
854 (if new-window '("-noraise")) | 866 (append |
855 (list "-remote" | 867 (if new-window '("-noraise")) |
856 (concat "openURL(" url | 868 (list "-remote" |
857 (if (browse-url-maybe-new-window | 869 (concat "openURL(" url |
858 new-window) | 870 (if (browse-url-maybe-new-window |
859 ",new-window") | 871 new-window) |
860 ")")))))))) | 872 (if browse-url-netscape-new-window-is-tab |
873 ",new-tab" | |
874 ",new-window")) | |
875 ")")))))))) | |
861 (set-process-sentinel process | 876 (set-process-sentinel process |
862 `(lambda (process change) | 877 `(lambda (process change) |
863 (browse-url-netscape-sentinel process ,url))))) | 878 (browse-url-netscape-sentinel process ,url))))) |
864 | 879 |
865 (defun browse-url-netscape-sentinel (process url) | 880 (defun browse-url-netscape-sentinel (process url) |