emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix bug with new firefox


From: Andreas Amann
Subject: Fix bug with new firefox
Date: Mon, 2 Mar 2015 17:13:31 +0000
User-agent: Notmuch/0.19 (http://notmuchmail.org) Emacs/25.0.50.1 (x86_64-unknown-linux-gnu)

Hi,

firefox 36.0 removed the "-remote" command line option, see
https://www.mozilla.org/en-US/firefox/36.0/releasenotes/

Unfortunately this breaks "browse-url-firefox" which depends on it. To
fix this, please apply the patch below.  I also put the patch on github
https://github.com/andram/emacs/commit/fd19dadba178f781117dfe524de834f337cbb1a6
not sure which is more convenient for devs, as I am not a regular
contributor.

Comment of patch: Patch now uses "--new-tab" and "--new-window" command
line args, which are supported since a long time.  This makes the
sentinel redundant.  It should in theory also work on MS-Windows, and
even improve the situation in that links can now also be opened in a new
tab if desired. However, I only tested the patch on linux.

Thanks
Andreas

>From fd19dadba178f781117dfe524de834f337cbb1a6 Mon Sep 17 00:00:00 2001
From: Andreas Amann <address@hidden>
Date: Mon, 2 Mar 2015 16:49:15 +0000
Subject: [PATCH] support for "-remote" was removed in firefox 36.0

Use "--new-tab" and "--new-window" instead in browse-url-firefox
---
 lisp/ChangeLog         |  6 ++++++
 lisp/net/browse-url.el | 45 +++++++--------------------------------------
 2 files changed, 13 insertions(+), 38 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7ce2e81..d39ed27 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-02  Andreas Amann  <address@hidden>
+
+       * net/browse-url.el (browse-url-firefox): support for "-remote"
+       was removed in firefox 36.0.  Use "--new-tab" and "--new-window"
+       instead.
+
 2015-03-02  Daniel Colascione  <address@hidden>
 
        * vc/vc.el (vc-responsible-backend): Add autoload cooking for
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 42fb954..b0c6064 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -1117,53 +1117,22 @@ 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'.
-
-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."
+NEW-WINDOW is used instead of `browse-url-new-window-flag'."
   (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))))))
+                 (if (browse-url-maybe-new-window new-window)
+                     (if browse-url-firefox-new-window-is-tab
+                         '("--new-tab")
+                       '("--new-window"))
+                   '("--new-tab"))
+                 (list url)))))))
 
 ;;;###autoload
 (defun browse-url-chromium (url &optional _new-window)
-- 
2.3.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]