unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Hugh Lawson <hlawson@triad.rr.com>
Subject: Re: browse-url
Date: Tue, 05 Apr 2005 00:36:07 GMT	[thread overview]
Message-ID: <87r7hqktbr.fsf@desktop.xx.yy> (raw)
In-Reply-To: x5ekdr8jsr.fsf@lola.goethe.zz

David Kastrup <dak@gnu.org> writes:

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

Thanks for the explanation, David.  I had trouble making it work, so
as a trial, I added the following two functions to my ~/.emacs file. 

Please critique. I did this purely empirically, with no real
understanding.



(defun browse-url-firefox (url &optional new-window )
  ;;new-window ignored
"Ask the firefox browser to  load URL."
 (apply 'call-process "firefox" nil
         0 nil (list url)))


(setq browse-url-browser-function  'browse-url-firefox)

-- 
Hugh Lawson
hlawson@triad.rr.com

  reply	other threads:[~2005-04-05  0:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-01  0:06 browse-url Hugh Lawson
2005-04-01  0:23 ` browse-url David Kastrup
2005-04-01  7:16   ` browse-url nfreimann
2005-04-01  9:37     ` browse-url David Kastrup
2005-04-04  0:02   ` browse-url Hugh Lawson
2005-04-04  0:31     ` browse-url David Kastrup
2005-04-05  0:36       ` Hugh Lawson [this message]
2005-04-05  1:29         ` browse-url David Kastrup
2005-04-05  2:30           ` browse-url Hugh Lawson
2005-04-05  4:28             ` browse-url Joe Corneli
2005-04-05  9:19               ` browse-url Greg Novak
2005-04-05 19:57                 ` browse-url Joe Corneli
     [not found]               ` <mailman.182.1112692644.2895.help-gnu-emacs@gnu.org>
2005-04-07 18:12                 ` browse-url Hugh Lawson
     [not found]             ` <mailman.152.1112673857.2895.help-gnu-emacs@gnu.org>
2005-04-05  8:20               ` browse-url Hugh Lawson
2005-04-05  9:11                 ` browse-url Joe Corneli
     [not found]                 ` <mailman.179.1112690775.2895.help-gnu-emacs@gnu.org>
2005-04-05 13:07                   ` browse-url Hugh Lawson
2005-04-05 13:43                     ` browse-url Hugh Lawson
2005-04-07  9:34                   ` browse-url Christian Lynbech
2005-04-07 14:47                     ` browse-url Hugh Lawson

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=87r7hqktbr.fsf@desktop.xx.yy \
    --to=hlawson@triad.rr.com \
    /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.
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).