From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Daniel Long Sockwell Newsgroups: gmane.emacs.bugs Subject: bug#39733: 26.3; Unclear direct color mode documentation can cause loading delays Date: Fri, 21 Feb 2020 21:36:05 -0500 Message-ID: <874kvjmjqi.fsf@codesections.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="5732"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.1.0; emacs 26.3 To: 39733@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 22 03:37:16 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 1j5KfL-0001N1-Cs for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Feb 2020 03:37:15 +0100 Original-Received: from localhost ([::1]:38322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5KfK-000127-1M for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 21 Feb 2020 21:37:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47051) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5KfB-00010t-AG for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 21:37:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5Kf9-0007DU-Nu for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 21:37:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42517) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j5Kf8-0007CQ-Fy for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 21:37:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j5Kf8-0007Xf-DQ for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 21:37:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Long Sockwell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Feb 2020 02:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 39733 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.158233900028949 (code B ref -1); Sat, 22 Feb 2020 02:37:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Feb 2020 02:36:40 +0000 Original-Received: from localhost ([127.0.0.1]:48490 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5Kem-0007Wr-4w for submit@debbugs.gnu.org; Fri, 21 Feb 2020 21:36:40 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:59458) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5Kek-0007Wj-B1 for submit@debbugs.gnu.org; Fri, 21 Feb 2020 21:36:38 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46969) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5Keh-0000vv-LP for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 21:36:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5Kef-0005id-40 for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 21:36:34 -0500 Original-Received: from out.migadu.com ([91.121.223.63]:58532) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j5Kee-0004O2-QU for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 21:36:33 -0500 Original-Received: (Migadu outbound); Sat, 22 Feb 2020 02:36:07 +0000 Authentication-Results: out.migadu.com; auth=pass (plain) Original-Received: from 2017 (45-16-201-121.lightspeed.iplsin.sbcglobal.net [45.16.201.121]) by out.migadu.com (Haraka/2.8.16) with ESMTPSA id 1D942D3D-2294-4538-9C36-FEBDD970BCDB.1 envelope-from (authenticated bits=0) (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 verify=FAIL); Sat, 22 Feb 2020 02:36:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; bh=F0AKK8ck1e8un2bWI5Cz9LzCN1neyw4JmWj9SaYhD+M=; c=relaxed/simple; d=codesections.com; h=from:subject:date:to; s=default; b=AD3UCA59FomlbJB35nlU8V0xyyEFZR0pSgK7/8UEELhXscLhTJMEwRlZv8DgTCbfyETQ5c615hZYKzPFC45TyoqIeBI4iSQfl2mByNaR52mqyrP2XTKlviZQHdaO7K2lefrnlZN6wIKxcYz6m5m7jrof7/wWyQH0YiCZaqpmqzY= 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:176389 Archived-At: The Emacs manual describes the process for enabling direct color mode for terminal Emacs with the following: > Emacs can be invoked with a custom definition as shown below >> $ cat terminfo-24bit.src >>=20=20=20=20=20 >> # Use colon separators. >> xterm-24bit|xterm with 24-bit direct color mode, >> use=3Dxterm-256color, >> setb24=3D\E[48:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&= %dm, >> setf24=3D\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=3Dxterm-256color, >> setb24=3D\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&= %dm, >> setf24=3D\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&= %dm, >>=20=20=20=20=20 >> $ tic -x -o ~/.terminfo terminfo-24bit.src >>=20=20=20=20=20 >> $ TERM=3Dxterm-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 =E2=80=93 instead= , I should have replaced "xterm" with my actual $TERM value. (In retrospect, that is fairly obvious, but it wasn't at the time, in part because I've come across other areas where setting a $TERM value of xterm was a valid workaround. And, as I said, following the directions literally appeared to work as shown by the output of `M-x list-colors-display`.) 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 =E2=80=93 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=3D1, tv_nsec=3D998526670}, {NULL, 8}) = =3D > 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. 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. Specifically, I believe that Section 5.3 should be updated to indicate that users should modify the custom definition provided to use the appropriate $TERM value for their own terminal. Beyond that, the fact that an incorrect $TERM setting results in a 2-second delay in launching Emacs may, itself, be an Emacs bug =E2=80=93 af= ter all, the incorrect $TERM/terminfo settings *worked* to display correct colors in Emacs. It may be that there is a way to avoid this delay, or at least to signal the error to the user via *Messages*. But I don't know enough about Emacs' internals to be sure of that. Either way, it was certainly an interesting process to debug! Best regards, Daniel In GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu) of 2019-09-18 built on svetlemodry System Description: Antergos Linux Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Making completion list... Configured using: 'configure --prefix=3D/usr --sysconfdir=3D/etc --libexecdir=3D/usr/lib --localstatedir=3D/var --without-x --without-sound --with-modules 'CFLAGS=3D-march=3Dx86-64 -mtune=3Dgeneric -O2 -pipe -fno-plt' CPPFLAGS=3D-D_FORTIFY_SOURCE=3D2 LDFLAGS=3D-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' Configured features: DBUS NOTIFY ACL GNUTLS LIBXML2 ZLIB MODULES THREADS LIBSYSTEMD Important settings: value of $LC_COLLATE: en_US.UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail tool-bar rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail regexp-opt rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils term/xterm xterm time-date elec-pair mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify multi-tty make-network-process emacs) Memory information: ((conses 16 97828 8897) (symbols 48 19448 1) (miscs 40 40 96) (strings 32 27649 1398) (string-bytes 1 739458) (vectors 16 11875) (vector-slots 8 449294 5376) (floats 8 49 66) (intervals 56 208 0) (buffers 992 12))