summaryrefslogtreecommitdiff
path: root/editors/emacs24/patches/patch-lisp_net_browse-url.el
blob: 6b62ff0580c814add04882c7717dca43dbd5778f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
$NetBSD: patch-lisp_net_browse-url.el,v 1.2 2015/03/03 13:47:14 ryoon Exp $

* Support firefox 36.0 or later.
  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19921

--- lisp/net/browse-url.el.orig	2014-05-14 02:59:18.000000000 +0000
+++ lisp/net/browse-url.el
@@ -337,6 +337,9 @@ Defaults to the value of `browse-url-fir
   :type '(repeat (string :tag "Argument"))
   :group 'browse-url)
 
+(make-obsolete-variable 'browse-url-firefox-startup-arguments
+                        "it no longer has any effect." "24.5")
+
 (defcustom browse-url-chromium-program
   (let ((candidates '("chromium" "chromium-browser")))
     (while (and candidates (not (executable-find (car candidates))))
@@ -1102,68 +1105,39 @@ used instead of `browse-url-new-window-f
 ;;;###autoload
 (defun browse-url-firefox (url &optional new-window)
   "Ask the Firefox WWW browser to load URL.
-Default to the URL around or before point.  The strings in
-variable `browse-url-firefox-arguments' are also passed to
-Firefox.
+Defaults to the URL around or before point.  Passes the strings
+in the variable `browse-url-firefox-arguments' to Firefox.
 
-When called interactively, if variable
-`browse-url-new-window-flag' is non-nil, load the document in a
-new Firefox window, otherwise use a random existing one.  A
-non-nil interactive prefix argument reverses the effect of
-`browse-url-new-window-flag'.
+Interactively, if the variable `browse-url-new-window-flag' is non-nil,
+loads the document in a new Firefox window.  A non-nil prefix argument
+reverses the effect of `browse-url-new-window-flag'.
 
 If `browse-url-firefox-new-window-is-tab' is non-nil, then
 whenever a document would otherwise be loaded in a new window, it
 is loaded in a new tab in an existing window instead.
 
-When called non-interactively, optional second argument
-NEW-WINDOW is used instead of `browse-url-new-window-flag'.
+Non-interactively, this uses the optional second argument NEW-WINDOW
+instead of `browse-url-new-window-flag'.
 
-On MS-Windows systems the optional `new-window' parameter is
-ignored.  Firefox for Windows does not support the \"-remote\"
-command line parameter.  Therefore, the
-`browse-url-new-window-flag' and `browse-url-firefox-new-window-is-tab'
-are ignored as well.  Firefox on Windows will always open the requested
-URL in a new window."
+On MS Windows, this ignores `browse-url-new-window-flag' and
+`browse-url-firefox-new-window-is-tab', as well as the NEW-WINDOW argument.
+It always uses a new window."
   (interactive (browse-url-interactive-arg "URL: "))
   (setq url (browse-url-encode-url url))
-  (let* ((process-environment (browse-url-process-environment))
-	 (use-remote
-	  (not (memq system-type '(windows-nt ms-dos))))
-	 (process
-	  (apply 'start-process
-		 (concat "firefox " url) nil
-		 browse-url-firefox-program
-		 (append
-		  browse-url-firefox-arguments
-		  (if use-remote
-		      (list "-remote"
-			    (concat
-			     "openURL("
-			     url
-			     (if (browse-url-maybe-new-window new-window)
-				 (if browse-url-firefox-new-window-is-tab
-				     ",new-tab"
-				   ",new-window"))
-			     ")"))
-		    (list url))))))
-    ;; If we use -remote, the process exits with status code 2 if
-    ;; Firefox is not already running.  The sentinel runs firefox
-    ;; directly if that happens.
-    (when use-remote
-      (set-process-sentinel process
-			    `(lambda (process change)
-			       (browse-url-firefox-sentinel process ,url))))))
-
-(defun browse-url-firefox-sentinel (process url)
-  "Handle a change to the process communicating with Firefox."
-  (or (eq (process-exit-status process) 0)
-      (let* ((process-environment (browse-url-process-environment)))
-	;; Firefox is not running - start it
-	(message "Starting Firefox...")
-	(apply 'start-process (concat "firefox " url) nil
-	       browse-url-firefox-program
-	       (append browse-url-firefox-startup-arguments (list url))))))
+  (let* ((process-environment (browse-url-process-environment)))
+    (apply 'start-process
+           (concat "firefox " url) nil
+           browse-url-firefox-program
+           (append
+            browse-url-firefox-arguments
+            ;; FIXME someone should check if this limitation
+            ;; still applies.
+            (unless (memq system-type '(windows-nt ms-dos))
+              (if (browse-url-maybe-new-window new-window)
+                  (if browse-url-firefox-new-window-is-tab
+                      '("-new-tab")
+                    '("-new-window"))))
+            (list url)))))
 
 ;;;###autoload
 (defun browse-url-chromium (url &optional _new-window)