Subject: bug#51297: 28.0.60; [PATCH] Update termcap/terminfo to indicate 16-color support

From: <[email-masked]>
Date: Wed, 20 Oct 2021 23:06:39 +0200

Jim Porter <[email-masked]> writes:

> On 10/20/2021 1:29 AM, miha--- via Bug reports for GNU Emacs, 
> the Swiss 
> army knife of text editors wrote:
>> In conclusion, I think we should update the terminfo, changing 
>> colors, setab and setaf, and leave term.el unchanged.  Patch 
>> attached.
>
> Thanks, this seems reasonable to me. I don't know much about the 
> details  of terminfo, so I wasn't aware of setab/setaf.
>
> More generally, I do wonder if we should be concerned with 
> making it  possible to distinguish between different versions of 
> Emacs, since 27,  28, and 29 all have different capabilities. At 
> least as I understand it,  If I SSH into a system, having 
> `TERM=eterm-color' isn't enough to know  whether 8, 16, or 256 
> colors are supported.

Yeah, that's a somewhat complicated problem.  I thought about the 
option of having something like 'TERM=eterm-16color' on Emacs-28 
in order to make Emacs-28 and Emacs-27 term.el distinguishable. 
The major downside of this option is that many terminal programs 
simply refuse to start if eterm-16color is not registered in the 
terminfo database (try running
'env TERM=eterm-16color top').  ssh-ing from term.el onto a system 
that rarely updates its terminfo database wouldn't be pleasant at 
all.

That's why I think its best to keep using 'TERM=eterm-color' and 
simply update the terminfo file.  Since all our updates to this 
file are backwards-compatible, there shouldn't be any major 
problems even if the terminfo database on the ssh host isn't up to 
date.  A problem does arise in the opposite case when the terminfo 
database on the host is up to date but the ssh client is term.el 
from Emacs version 27 or older.  TUI programs will think they can 
output sequences that the older term.el doesn't understand, but I 
think that term.el handles unknown sequences quite gracefully by 
simply ignoring them.

After Emacs-28 is released, we should probably talk to the ncurses 
maintainer about updating the eterm-color terminfo file 
distributed with the ncurses package.  From my understanding, the 
option I described in the previous paragraph is also the proffered 
way to update terminfo files in the ncurses package.