help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: browse-url


From: David Kastrup
Subject: Re: browse-url
Date: Mon, 04 Apr 2005 02:31:00 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Hugh Lawson <hlawson@triad.rr.com> writes:

> David Kastrup <dak@gnu.org> writes:
>
>> Hugh Lawson <hlawson@triad.rr.com> writes:
>> 
>> > Debian sarge
>> > Emacs 21.4.1
>> >
>> > browse-url works fine if firefox is already running. 
>> >
>> > But suppose firefox isn't running.
>> >
>> > If I do 'M-x browse-url' and fill in the url, then firefox pops up for
>> > a second and then disappears.  The same thing happens with links I
>> > click on in Emacs.
>> >
>> > I think I can imagine a shell script to deal with this, but surely
>> > there is something alread in Emacs.
>> 
>> The definition of browse-url-generic in browse-url.el needs to get
>> replaced with:
>> 
>> (defun browse-url-generic (url &optional new-window)
>>   ;; new-window ignored
>>   "Ask the WWW browser defined by `browse-url-generic-program' to load URL.
>> Default to the URL around or before point.  A fresh copy of the
>> browser is started up in a new process with possible additional arguments
>> `browse-url-generic-args'.  This is appropriate for browsers which
>> don't offer a form of remote control."
>>   (interactive (browse-url-interactive-arg "URL: "))
>>   (if (not browse-url-generic-program)
>>     (error "No browser defined (`browse-url-generic-program')"))
>>   (apply 'call-process browse-url-generic-program nil
>>       0 nil
>>       (append browse-url-generic-args (list url))))
>
>
> I don't understand how this solves my problem.  If mozilla-firefox
> is open and running. all is well. If it isn't then there is a
> problem.

Emacs has several possibilities to start processes.  Starting with
call-process and 0 as third argument detaches the process completely
from Emacs.

Starting the process with start-process, in contrast, leaves the
process associated with Emacs.  If the process detaches itself from
the tty, Emacs assumes that it is finished and kills the process
group.  This is what happens with new Firefoxes that try to escape the
Emacs tty.

This is why you need an Elisp function that will use call-process
instead of start-process for starting Firefox if it is supposed to
survive detaching.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


reply via email to

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