From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#39733: 26.3; Unclear direct color mode documentation can cause loading delays Date: Sat, 22 Feb 2020 09:56:38 +0200 Message-ID: <831rqnjbrd.fsf@gnu.org> References: <874kvjmjqi.fsf@codesections.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="53910"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 39733@debbugs.gnu.org To: Daniel Long Sockwell Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 22 08:57:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j5Pey-000DsZ-70 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Feb 2020 08:57:12 +0100 Original-Received: from localhost ([::1]:39810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5Pew-0000es-Pz for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Feb 2020 02:57:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55924) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5Pep-0000em-C2 for bug-gnu-emacs@gnu.org; Sat, 22 Feb 2020 02:57:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5Pen-00048X-WE for bug-gnu-emacs@gnu.org; Sat, 22 Feb 2020 02:57:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42568) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j5Pen-00048M-T4 for bug-gnu-emacs@gnu.org; Sat, 22 Feb 2020 02:57:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j5Pen-0007ME-QW for bug-gnu-emacs@gnu.org; Sat, 22 Feb 2020 02:57:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Feb 2020 07:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39733 X-GNU-PR-Package: emacs Original-Received: via spool by 39733-submit@debbugs.gnu.org id=B39733.158235821428269 (code B ref 39733); Sat, 22 Feb 2020 07:57:01 +0000 Original-Received: (at 39733) by debbugs.gnu.org; 22 Feb 2020 07:56:54 +0000 Original-Received: from localhost ([127.0.0.1]:48541 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5Pef-0007Ls-QU for submit@debbugs.gnu.org; Sat, 22 Feb 2020 02:56:54 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40703) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5Pee-0007Lg-9I for 39733@debbugs.gnu.org; Sat, 22 Feb 2020 02:56:52 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:49954) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j5PeY-0003xu-ST; Sat, 22 Feb 2020 02:56:46 -0500 Original-Received: from [176.228.60.248] (port=2295 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1j5PeY-0006LL-Ac; Sat, 22 Feb 2020 02:56:46 -0500 In-reply-to: <874kvjmjqi.fsf@codesections.com> (message from Daniel Long Sockwell on Fri, 21 Feb 2020 21:36:05 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:176391 Archived-At: > From: Daniel Long Sockwell > Date: Fri, 21 Feb 2020 21:36:05 -0500 > > > Emacs can be invoked with a custom definition as shown below > >> $ cat terminfo-24bit.src > >> > >> # Use colon separators. > >> xterm-24bit|xterm with 24-bit direct color mode, > >> use=xterm-256color, > >> setb24=\E[48:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%dm, > >> setf24=\E[38:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%dm, > >> # Use semicolon separators. > >> xterm-24bits|xterm with 24-bit direct color mode, > >> use=xterm-256color, > >> setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm, > >> setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm, > >> > >> $ tic -x -o ~/.terminfo terminfo-24bit.src > >> > >> $ TERM=xterm-24bit emacs -nw > Source: Emacs FAQ, 5.3 > > I followed these directions literally, and enabled direct color support > in Emacs, apparently without issue. However, what I did not realize was > that I ought *not* to have followed the example literally – instead, I > should have replaced "xterm" with my actual $TERM value. If the terminfo entry uses xterm-24bits, then you _do_ have to use xterm-24bit as the value of TERM. If you want any other terminal, the terminfo entry should have a different name. The example shows it for xterm. > Months later, I realized that I was experiencing a very odd bug: my > Emacs instance was taking well over 2 seconds to start in a terminal, > even when invoked with `emacs -Q -nw`. Even more oddly, I determined > `M-x emacs-init-time` showed a very low time – whatever was causing the > slowdown was outside of the normal init process. After fairly extensive > testing, I discovered that the slowdown was caused by a pselect > timeout. This one, according to strace: > > > pselect6(5, [4], [], NULL, {tv_sec=1, tv_nsec=998526670}, {NULL, 8}) = > > 0 (Timeout) <2.000940> > > After even more testing, I determined that the issue was caused by the > terminfo/$TERM settings: apparently, if the user has a $TERM value that > does not match their terminal, Emacs will have a 2-second delay before > launching, waiting for whatever that pselect call is looking for. That's because for xterm we support additional features, unrelated to colors, which need to be probed at startup. The probe sends a special control sequence to the terminal, and then waits for the response with a 2 sec timeout. Your terminal doesn't support those control sequences, so it seems, so you get the timeout. > Once I finally figured the above out, I decided to file this bug in the > hope that the documentation can be updated and other can avoid spending > as long with this issue as I did. The latest version of the Emacs FAQ already says at the end of this section: If your terminal is incompatible with XTerm, you may have to use another ‘TERM’ definition. Any terminal whose name includes ‘direct’ should be a candidate. The ‘toe’ command can be used to find out which of these are installed on your system: $ toe | grep '\-direct' konsole-direct konsole with direct-color indexing vte-direct vte with direct-color indexing st-direct st with direct-color indexing xterm-direct2 xterm with direct-color indexing (old) xterm-direct xterm with direct-color indexing Terminals with ‘RGB’ capability treat pixels #000001 - #000007 as indexed colors to maintain backward compatibility with applications that are unaware of direct color mode. Therefore the seven darkest blue shades may not be available. If this is a problem, you can always use custom terminal definition with ‘setb24’ and ‘setf24’. Given this addition, do you see anything else that needs to be changed in the FAQ? Thanks.