Re: Default editor - how is it set?

Urs Janßen <[email protected]> Wed, 03 Feb 2010 00:09:28 +0100
Newsgroups gmane.network.tin.user
Organization tin.org
Message-ID <[email protected]>
In <20100202182149.GB10933@chris>, Chris G wrote:
> For some reason my copy of tin has started selecting nano as my editor
> instead of vi.  I have never had either EDITOR or VISUAL set in my
> environment so I'm at a loss to understand why it has changed.
> 
> How does tin decide what editor to use?

first of all it looks at editor_format in attributes and/or tinrc, if
there is a 'hardcoded' entry that will be used, if the entry uses %E
then %E will expand to ${VISUAL:-"${EDITOR}":

tin(1)
| ENVIRONMENT
[...]
|   VISUAL This  variable  has  precedence  over  the default editor (i.e.,
|          vi(1)) that is used in all editing operations within tin  (e.g.,
|          posting,  replying, follow-ups, ...). Evaluation order is ${VIS-
|          UAL:-"${EDITOR:-vi}"}. See environ(5) for more infos.
|
|   EDITOR If $VISUAL is unset, then this  variable  is  looked up  for  a
|          default  editor. If $EDITOR and $VISUAL are both unset, tin will
|          uses the systems default editor (i.e. vi(1)) on UNIX-systems).
|          See environ(5) for more infos.

if $VISUAL and $EDITOR are unset, tin falls back tin DEFAULT_EDITOR
which usualy is determined during configure and is either the value
specified via --with-editor or if that is not given the value of
$EDITOR or $VISUAL. if neither is set if falls back to vi.

> The only thing I can think of that has changed recently which might
> affect this is that I have moved vi from /usr/local/bin to /usr/bin.

just a guess: configured tin as root which has $EDITOR or $VISUAL set
to nano or /usr/bin/editor which is a symlink to nano or the like.

urs
-- 
Jef Poskanzer:
"When people aren't stupid Usenet is even more useful. Too bad this happens
 so rarely."