From mboxrd@z Thu Jan  1 00:00:00 1970
Path: main.gmane.org!not-for-mail
From: Vektor <XYZvektorXYZ@XYZyeahXYZ.net>
Newsgroups: gmane.emacs.help
Subject: Re: run shell-command in the background?
Date: Wed, 25 Aug 2004 08:44:41 +0800
Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org
Message-ID: <cggnpe$uft$1@quimby.gnus.org>
References: <cggkl8$qr1$1@quimby.gnus.org> <x5r7pwxexy.fsf@lola.goethe.zz>
NNTP-Posting-Host: deer.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: sea.gmane.org 1093395646 26821 80.91.224.253 (25 Aug 2004 01:00:46 GMT)
X-Complaints-To: usenet@sea.gmane.org
NNTP-Posting-Date: Wed, 25 Aug 2004 01:00:46 +0000 (UTC)
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 25 03:00:35 2004
Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>
Original-Received: from lists.gnu.org ([199.232.76.165])
	by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian))
	id 1Bzm9T-0005Wb-00
	for <geh-help-gnu-emacs@m.gmane.org>; Wed, 25 Aug 2004 03:00:35 +0200
Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.33)
	id 1BzmE0-0007XW-Ad
	for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Aug 2004 21:05:16 -0400
Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!t-online.de!npeer.de.kpn-eurorings.net!news.tele.dk!news.tele.dk!small.news.tele.dk!uio.no!quimby.gnus.org!not-for-mail
Original-Newsgroups: gnu.emacs.help
Original-Lines: 71
Original-NNTP-Posting-Host: 61.190.137.215
Original-X-Trace: quimby.gnus.org 1093395054 31229 61.190.137.215 (25 Aug 2004 00:50:54
	GMT)
Original-X-Complaints-To: usenet@quimby.gnus.org
Original-NNTP-Posting-Date: Wed, 25 Aug 2004 00:50:54 +0000 (UTC)
User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)
Original-Xref: shelby.stanford.edu gnu.emacs.help:124921
Original-To: help-gnu-emacs@gnu.org
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/help-gnu-emacs>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org
Xref: main.gmane.org gmane.emacs.help:20270
X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:20270

actually this is what i am doing.

the runmoz script is good so that  even i C-g when emacs freeze, the
mozilla will continue running without exit.

but "shell-command &" will do nothing good.



this is from my .emacs.el
---------------------------------------------------------------
;; browser url with mozilla
(when window-system
  (setq browse-url-browser-function 'browse-url-mozilla)
  (setq browse-url-mozilla-program "runmoz")
  (defun browse-url-mozilla (url &optional new-window)
    ;; new-window ignored
    "Open URL in a new tab in Mozilla."
    (interactive (browse-url-interactive-arg "URL: "))
    (message "Starting Mozilla...")
    (shell-command (concat browse-url-mozilla-program " " url))
    (message "Starting Mozilla...done"))
  )
---------------------------------------------------------------

runmoz
----------------------------------------------------------------
#!/bin/sh
#run new url in
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
# my mozilla need some lib to be loaded

MOZ_PATH=/usr/local/tools/mozilla-1.7/bin

if [ $# = 0 ]; then

    $MOZ_PATH/mozilla -remote 'ping()' &> /dev/null
    if ! [ $? = 0 ]; then
        $MOZ_PATH/mozilla & > /dev/null &
    fi

else
    $MOZ_PATH/mozilla -remote "openURL($1,new-tab)" &> /dev/null
    if ! [ $? = 0 ]; then
        $MOZ_PATH/mozilla "$1" & > /dev/null &
    fi
fi
-----------------------------------------------------------------


David Kastrup <dak@gnu.org> writes:

> Vektor <XYZvektorXYZ@XYZyeahXYZ.net> writes:
>
>> if i use (shell-command "my-script"), the emacs will run the script
>> and freeze itself.
>> is it possible to run a shell command in the background?
>> 
>> 
>> ps: actually, this script is named "runmoz", it handle the "open
>> new-tab in an already running mozilla, otherwise start a mozilla"
>> stuff. 
>
> You know browse-url ?
>
> -- 
> David Kastrup, Kriemhildstr. 15, 44793 Bochum

-- 
Remove all XYZ from my email to get the real one.