[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16988: xterm--version-handler, accepting any terminal type rather th

From: Stefan Monnier
Subject: bug#16988: xterm--version-handler, accepting any terminal type rather than 0
Date: Wed, 12 Mar 2014 10:32:21 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Hi Trevor,

Looks like my fear about "other terminal types" was not unfounded after
all: gnome-terminal uses a terminal type of 1 and that leads to problems
(see http://debbugs.gnu.org/16988 for the discussion).

I'm leaning towards the conservative option of replacing your "[0-9]+"
with "0\\|41", WDYT?


--- Begin Message --- Subject: bug#16988: 24.3.50; emacs -nw -Q --eval '(kill-emacs)' takes 2 seconds unless I hit a key Date: Wed, 12 Mar 2014 09:59:13 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
Eli Zaretskii <address@hidden> writes:
>> $ time src/emacs -nw -Q --eval '(kill-emacs)'
>> real 0m2.064s
>> user 0m0.030s
>> sys  0m0.010s

> My crystal ball says that your TERM variable points to xterm, but your
> terminal either isn't xterm or doesn't support the kind of queries
> that xterm--query on xterm.el uses.  That function indeed waits for 2s
> for the terminal to respond. 

Since it was not a problem before, I bisected that down to commit:
commit 7e594297002c7bc07083fa8d01552255e831ba2a
Author: W. Trevor King <address@hidden>
Date:   Wed Feb 19 23:45:19 2014 -0500

    * lisp/term/xterm.el (xterm--version-handler): Adapt to xterm-280's output.

which changed xterm--version-handler (in lisp/term/xterm.el) in the following 

-    (when (string-match "0;\\([0-9]+\\);0" str)
-      (let ((version (string-to-number (match-string 1 str))))
+    ;; Since xterm-280, the terminal type (NUMBER1) is now 41 instead of 0.
+    (when (string-match "\\([0-9]+\\);\\([0-9]+\\);0" str)
+      (let ((version (string-to-number (match-string 2 str))))

That has the effect of now matching gnome-terminal's string (it begins
with 1 on my platform).

As a side effect of this, calling "emacsclient -t" from within
gnome-terminal currently acts weird : it shows the wrong buffer for up
to two second and --if you press some keys before the 2 seconds-- it
shows a few weird chars (a query to the terminal) (until next time that
part of the screen is redrawn ?).

I now see three approaches :
0. Do nothing, and let users fix their terminal emulator and/or terminfo
   entries. (alternatively : provide guidance for doing this.)
1. Like it is done now for rxvt (in function terminal-init-xterm), add
   some ad-hoc code for detecting gnome-terminal which pretends to be
   xterm (in fact the exact same approach might work : $COLORTERM is
   gnome-terminal when using gnome-terminal).
2. Test also (match-string 1 str) in the above code and make sure it is
   either 0 or 41. (it is equal to 1 in my gnome-terminal)

Opinions ?


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]