emacs-devel
[Top][All Lists]
Advanced

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

Re: browse-url-firefox


From: Eli Zaretskii
Subject: Re: browse-url-firefox
Date: Sat, 05 Jan 2008 19:43:37 +0200

> Date: Sat, 05 Jan 2008 18:31:22 +0200
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden
> 
>         (apply 'start-process
>                (concat "firefox " url) nil
>                browse-url-firefox-program
>                (append
>                 browse-url-firefox-arguments
>                 (if (or (featurep 'dos-w32)
>                         (string-match "win32" system-configuration))
>                     (list url)
>                   (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"))
>                                 ")")))))))
> 
> has the effect of invoking Firefox with the URL specified twice on the
> command line (so Firefox opens it in two tabs).  I think it's a bug,
> and that the right fix is to not (concat "firefox " url), but to use a
> literal "firefox" instead.  Does anyone see where I'm wrong?
> 
> Steve, do you have any objections to such a change?

Also, why do we need to set up a process-sentinel in this case?
Here's the relevant fragments from browse-url:

       (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))))))

At least on MS-Windows, when an instance of Firefox is already
running, invoking another one like "firefox http://foo.bar"; has the
effect of asking the first instance of Firefox to display
http://foo.bar in another tab, and the second Firefox exits
immediately.  So the above sentinel has 2 adverse effects: (1) it
opens http://foo.bar twice, because the sentinel is invoked when the
second instance of Firefox exits, and (2) the sentinel is invoked if I
close Firefox by via the window manager, at which time the sentinel
starts Firefox again with the last URL I browsed.

Is the behavior of Firefox on other platforms different?

I think the right fix for this is to set-process-sentinel to nil.  Any
objections?




reply via email to

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