I’m happy with the switch and want to continue to use
st. However, I’ve noticed that certain terminal applications are unhappy with the new
$TERM value. For example,
emacs will not load in
st with full color support unless I “trick” it into thinking that
$TERM is something recognizable like
My question is: what’s the risk of simply setting
$TERM=xterm-256color? It seems to me that the important part of
$TERM=*-256color is the
256color part and the value of
* seems less important.
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
The important part of the value of
TERM is that it matches an entry in the terminfo or termcap databases, and that that entry correctly describes your terminal.
You cannot reasonably go telling softwares that your terminal is XTerm, when it blatantly is not. And it is an outright error to think that other terminal emulators use all the same input/output control sequences as XTerm or provide all the same functionality.
-256color is simply a part of a name, it has no inherent meaning to most softwares (albeit that a very few do look for feature suffixes). It (primarily) only has meaning to human beings, as it is human beings that group the entries in the terminfo/termcap databases into families by their names. The feature suffixes in terminal type names are primary for humans, not for softwares.
The thing that has meaning to softwares is whether the record in the database that is so named says that the terminal supports 256 colours, and provides the control sequences for using them on that type of terminal.
That said, emacs does do its own thing, and does not simply rely upon the terminfo/termcap database. For example, it is known that its
frame-set-background-mode function matches the value of
^\(xterm\|\rxvt\|dtterm\|eterm\), which is probably wrong nowadays. The correct approach here is to fix emacs so that, at last, it properly recognizes the
st-256color terminal type (and
vte-256color, and others).
- Jonathan de Boyne Pollard (2019). “TERM“. Miscellany. nosh toolset.
- Jonathan de Boyne Pollard (2019). “TerminalCapabilities“. Miscellany. nosh toolset.
- How and where is $TERM interpreted?
- “Terminal-Specific Initialization“. emacs Lisp. Free Software Foundation.