conditional rc.

2002-08-14 Thread Bo Peng

Hi, there

Can I do something like:

if have_X
  editor = gvim -f
else
  editor = vim
end

in my .muttrc file?

Thanks.
Bo



Re: conditional rc.

2002-08-14 Thread Rob Reid

At  9:50 AM EDT on August 14 Bo Peng sent off:
 Hi, there
 
 Can I do something like:
 
 if have_X
   editor = gvim -f
 else
   editor = vim
 end
 
 in my .muttrc file?

I don't think so, but instead of putting something like that in each
application's configuration file, you can put it in a script,
i.e. /usr/local/bin/editor or ~/bin/editor

%=
!/bin/sh

editor=jed
serverrunning=`ps -u ${USER} | grep emacsserver`
if [ ${serverrunning} !=  ] ; then
editor=emacsclient
fi
exec ${editor} $
%

and setenv (or export) EDITOR editor will take care of most things, and
specifying editor in the app's config file will take care of the rest.

-- 
Some people have told me they don't think a fat penguin really embodies the
grace of Linux, which just tells me they have never seen a angry penguin
charging at them in excess of 100mph. They'd be a lot more careful about what
they say if they had.  - Linus Torvalds (announcing Linux v2.0)
Robert I. Reid | PGP/GPG Keys: http://astro.utoronto.ca/~reid/pgp.html



Re: conditional rc.

2002-08-14 Thread Andre Berger

* Bo Peng [EMAIL PROTECTED], 2002-08-14 20:39 +0200:
 Hi, there
 
 Can I do something like:
 
 if have_X
   editor = gvim -f
 else
   editor = vim
 end
 
 in my .muttrc file?

set editor=[ -z $DISPLAY ]  vim || gvim -f

(untested) should do for bash.

-Andre