From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Colors on TTY (v26) Date: Sun, 31 Mar 2019 18:15:44 +0300 Message-ID: <83v9zzgjmn.fsf@gnu.org> References: Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="231407"; mail-complaints-to="usenet@blaine.gmane.org" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Mar 31 17:15:50 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hAcBZ-000y4u-Vy for geh-help-gnu-emacs@m.gmane.org; Sun, 31 Mar 2019 17:15:50 +0200 Original-Received: from localhost ([127.0.0.1]:43204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAcBY-0004gA-PX for geh-help-gnu-emacs@m.gmane.org; Sun, 31 Mar 2019 11:15:48 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAcBM-0004bm-1k for help-gnu-emacs@gnu.org; Sun, 31 Mar 2019 11:15:37 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:57279) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAcBL-0003b0-UC for help-gnu-emacs@gnu.org; Sun, 31 Mar 2019 11:15:36 -0400 Original-Received: from [176.228.60.248] (port=3210 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hAcBL-0000En-E7 for help-gnu-emacs@gnu.org; Sun, 31 Mar 2019 11:15:35 -0400 In-reply-to: (message from Aleksey Midenkov on Sun, 31 Mar 2019 11:22:59 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:119790 Archived-At: > From: Aleksey Midenkov > Date: Sun, 31 Mar 2019 11:22:59 +0300 > > Trial and error shown that emacs holds special knowledge on terminal names: > f.ex. "xterm-something" works as 256 colors and "xterm2" works as 16 > colors. This is in fact very strange because there are terminals like > "screen.xterm-256color". > So it's not good to hold special magic about term names for that. Why it > doesn't check terminfo db for that (though it checks for 24bit as doc > states)? Looks like a bug to me. > > To test it: > 1. infocmp your current term into file; > 2. rename file and rename term inside it; > 3. tic renamed file; > 4. set TERM to renamed term. > > And voila: it's either 256 or 16 colors depending on term name! Emacs doesn't hard-code terminal names, but it has Lisp libraries under lisp/term/ which are loaded by the terminal name. If you have a terminal that behaves like one of the ones known to Emacs, you need only copy the relevant Lisp library under lisp/term/ to the name of your terminal (with the .el extension), and things should work from there. > Another bug: > (list-color-display) > always shows 16 colors from .emacs file (or from -f option). It detects 256 > colors somehow later and then list-colors-display executed interactively > shows different result. The full color list is indeed set during startup, so if you invoke list-colors-display too early during startup, you will not see that. This is not a bug, as Emacs can not know the color capabilities of the terminal until it probes them.