scripting gnuclient and emacs for mutt [ was: emacsclient -nw]
On Wed, Nov 19, 2003 at 02:54:48PM -0500, David Z Maze wrote:
> Matt Price <matt.price@utoronto.ca> writes:
>
> While this doesn't help your actual problem, you should probably be
> aware that 'emacs' and 'xemacs' are separate programs, either of which
> can run in X or not in X. ('xemacs -nw' works; 'emacs' with $DISPLAY
> set will pop up an X window.)
Hey, I really hadn't understood this, thanks, this helps!
> See earlier commentary about XEmacs; gnuclient(1) is the XEmacs
> equivalent to emacsclient, and it does claim to support a -nw option.
> I could see things being unhappy if you set $EDITOR to that, but it's
> easy enough to write a shell script:
>
> #!/bin/sh
> # moremacs: open a file under gnuclient
> exec gnuclient -nw "$@"
gnuclient -nw does indeed work! thanks.
Now a question: the problem with setting my editor to gnuclient -nw
is that I may at times not have xemacs running on the computer. Then
gnclient exits with an error message, and I can't write mail (not
fatal) -- in mutt I can get a shell and start xemacs -unmapped; but
still...) So I'd like to wrote a script that does something like
this:
-try to run gnuclient; if it works, exit
else
-run xemacs -nomapped
-run gnuclient
is it possible in bash to test whether a comand has actually worked?
I feel like I've seen such tests, but I tried one and can't make it
work for me:
#! /bin/bash
if [ 'gnuclient -q $*' ]; then
echo "no problem, xemacs running"
gnuclient -q $*
else
echo "starting xemacs"
/usr/bin/xemacs -unmapped $* &
/usr/bin/gnuclient -q $*
fi
So for now I have the following:
#! /bin/bash
if [ "A`ps -e | grep xemacs | grep -v grep`" = "A" ]; then
/usr/bin/gnuclient -q $*
else
/usr/bin/xemacs $* &
fi
this always exits with an error:
XEmacs: standard input is not a tty
anyone know why I'm getting that?
thanks as always for the help,
matt
Reply to: