unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: steve@xemacs.org, emacs-devel@gnu.org
Subject: Re: browse-url-firefox
Date: Sat, 05 Jan 2008 19:43:37 +0200	[thread overview]
Message-ID: <uzlvktbg6.fsf@gnu.org> (raw)
In-Reply-To: <u4pdsutd1.fsf@gnu.org> (message from Eli Zaretskii on Sat, 05 Jan 2008 18:31:22 +0200)

> Date: Sat, 05 Jan 2008 18:31:22 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> 	  (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	other threads:[~2008-01-05 17:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-05 16:31 browse-url-firefox Eli Zaretskii
2008-01-05 17:43 ` Eli Zaretskii [this message]
2008-01-05 18:01   ` browse-url-firefox Gian Uberto Lauri
2008-01-05 18:16   ` browse-url-firefox Lennart Borgman (gmail)
2008-01-06  0:40 ` browse-url-firefox Steve Youngs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=uzlvktbg6.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=steve@xemacs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).