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

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

Re: run shell-command in the background?


From: Vektor
Subject: Re: run shell-command in the background?
Date: Wed, 25 Aug 2004 08:44:41 +0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

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.


reply via email to

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