Subject: Re: [PATCH] send-email: lazily assign editor variable

From: Jonathan Nieder <[email-masked]>
Date: Fri, 26 Mar 2010 16:45:41 -0500

Junio C Hamano wrote:
> Jonathan Nieder <[email-masked]> writes:

>> Yes, please.  It would be more precise to
>>
>>   s/without a tty/with TERM=dumb/
>>
>> in the second paragraph but regardless this is a good description of the
>> problem.
>
> Strictly speaking, with TERM=dumb the true "vi" fell back to the ex mode
> and should have been usable.  A purist might say it is a bug that we fatal
> out in this case (I know that it is deliberately done to help newbies from
> common confusion by not running any editor with TERM=dumb, but to a purist
> in me it feels somewhat wrong).

With DISPLAY set, running “TERM=dumb vi | cat” with an appropriate
symlink in $PATH:

vim
	Prints “Vim: Warning: Output is not to a terminal” to stderr,
	waits about a second, then
	runs without clearing the screen, using ANSI escapes to move around.

elvis 1.4
	Prints “This termcap entry lacks the :up=: capability” to stderr,
	fails with status 1.

elvis 2 (more precisely, the elvisnox script from Debian)
	Prints “termcap needs up” to stderr,
	fails with status 1.

nvi
	Prints “ex/vi: Vi's standard input and output must be a terminal” to stderr,
	fails with status 1.

With TERM=dumb but standard output going straight to the terminal, the
situation is not very different for vim and elvis, while nvi gets
utterly confused (it only writes output to the bottom line for some
reason).

So I think it still makes sense to work around this bug in the vi clones.

HTH,
Jonathan