unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* browse-url-firefox
@ 2008-01-05 16:31 Eli Zaretskii
  2008-01-05 17:43 ` browse-url-firefox Eli Zaretskii
  2008-01-06  0:40 ` browse-url-firefox Steve Youngs
  0 siblings, 2 replies; 5+ messages in thread
From: Eli Zaretskii @ 2008-01-05 16:31 UTC (permalink / raw)
  To: Steve Youngs; +Cc: emacs-devel

The following fragment from browse-url-firefox:

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: browse-url-firefox
  2008-01-05 16:31 browse-url-firefox Eli Zaretskii
@ 2008-01-05 17:43 ` Eli Zaretskii
  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
  1 sibling, 2 replies; 5+ messages in thread
From: Eli Zaretskii @ 2008-01-05 17:43 UTC (permalink / raw)
  To: steve, emacs-devel

> 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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: browse-url-firefox
  2008-01-05 17:43 ` browse-url-firefox Eli Zaretskii
@ 2008-01-05 18:01   ` Gian Uberto Lauri
  2008-01-05 18:16   ` browse-url-firefox Lennart Borgman (gmail)
  1 sibling, 0 replies; 5+ messages in thread
From: Gian Uberto Lauri @ 2008-01-05 18:01 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: steve, emacs-devel

>>>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:

EZ> Is the behavior of Firefox on other platforms different?

AFAIK (aka in my Debian testing GNU/Linux) it is not.

But I  used to run this script  to launch it for  text/html mime parts
using vm (saint is my username :) ) :

#!/bin/bash

if ps -fu saint | grep iceweasel | grep -v grep > /dev/null
then
	iceweasel -remote "openurl("$1")"
else
	iceweasel  $1 &
fi

#!/bin/bash

if ps -fu saint | grep iceweasel | grep -v grep > /dev/null
then
	iceweasel -remote "openurl("$1")"
else
	iceweasel  $1 &
fi

-- 
 /\           ___                                    Ubuntu: ancient
/___/\_|_|\_|__|___Gian Uberto Lauri_____               African word
  //--\| | \|  |   Integralista GNUslamico            meaning "I can
\/                   e coltivatore diretto               not install
                               di software                   Debian"

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: browse-url-firefox
  2008-01-05 17:43 ` browse-url-firefox Eli Zaretskii
  2008-01-05 18:01   ` browse-url-firefox Gian Uberto Lauri
@ 2008-01-05 18:16   ` Lennart Borgman (gmail)
  1 sibling, 0 replies; 5+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-05 18:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: steve, emacs-devel

Eli Zaretskii wrote:
>> 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?

The second argument to `start-process' is just a name so I can see 
nothing wrong with that it is (concat "firefox " url).

BTW, why are the arguments different on w32? It looks like the other 
path works for w32 too.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: browse-url-firefox
  2008-01-05 16:31 browse-url-firefox Eli Zaretskii
  2008-01-05 17:43 ` browse-url-firefox Eli Zaretskii
@ 2008-01-06  0:40 ` Steve Youngs
  1 sibling, 0 replies; 5+ messages in thread
From: Steve Youngs @ 2008-01-06  0:40 UTC (permalink / raw)
  To: emacs-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message

* Eli Zaretskii <eliz@gnu.org> writes:

  > The following fragment from browse-url-firefox:
  > 	  (apply 'start-process
  > 		 (concat "firefox " url) nil
  > 		 browse-url-firefox-program

[...]

  > 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?

Yes.  The first arg to #'start-process is just a name to give to the
process so it can be more easily identified, it doesn't have anything to
do with the actual running of the started process.

I've not witnessed the behaviour you're describing, not in any version
of Firefox from 1.0 to the current 3.0 betas.

  > Steve, do you have any objections to such a change?

I have no objections if you want to make this change, Eli, but there's
not much point in doing so.

  > Also, why do we need to set up a process-sentinel in this case?

  > 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.

OK, this appears to be the case for Linux now as well, but I'm fairly
sure it wasn't always like that in earlier versions of Firefox.  And
starting Firefox with `-remote' when there is no running instance gives
you an error.  Hence, the sentinel.

  > 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.

I've not witnessed this behaviour either.  And I'm not sure which of
Firefox, Emacs, MS-Win, or some combo-special, that is to blame.

  > Is the behavior of Firefox on other platforms different?

Apparently so. :-)

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

Yes.  You would also need to remove the `-remote' arg in
#'browse-url-firefox.  Of course, you'd only make these changes if I'm
wrong about how earlier versions of Firefox handle starting with
`firefox http://some.site/' when an instance of Firefox is already
running (for non-MS platforms).

-- 
|---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---|
|            SXEmacs - Even teddy bears love it!           |
|    Get your sxe teddy at <http://store.sxemacs.org/>     |
|------------------------------------<steve@sxemacs.org>---|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: The SXEmacs Project <http://www.sxemacs.org/>
Comment: EMchat - The SXEmacs IM client <http://www.emchat.org/>

iEYEARECAAYFAkeAI3oACgkQHSfbS6lLMAOGOgCgzrGSnXDErZUb8WpU7LDKAUIP
dnwAoNdYOv+D/Z46GkfEtFjVc2ja3cGG
=uUxV
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-01-06  0:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-05 16:31 browse-url-firefox Eli Zaretskii
2008-01-05 17:43 ` browse-url-firefox Eli Zaretskii
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

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