GNU bug report logs -
#13839
xterm/mintty control sequences support when formatOtherKeys = 1
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13839 in the body.
You can then email your comments to 13839 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
victorhge <at> gmail.com, bug-gnu-emacs <at> gnu.org
:
bug#13839
; Package
emacs
.
(Thu, 28 Feb 2013 15:45:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
New bug report received and forwarded. Copy sent to
victorhge <at> gmail.com, bug-gnu-emacs <at> gnu.org
.
(Thu, 28 Feb 2013 15:45:04 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Moving this to the bug tracker.
[Message part 2 (message/rfc822, inline)]
>>>>> "" == Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:
>> For example, pressing C-0 in xterm will send control sequence
>> "\e[27;5;48~" by default, which is supported now. When
>> "formatOtherKeys" is set to 1, C-0 is sent as "\e[48;5u" which is
>> another shorter format.
>> The easiest change I can image is to define a lot of key binds
>> for those control sequence, for example, (define-key map
>> "\e[48;5u" [?\C-0])
> Y see, that looks fine. If you can prepare a patch for it, I'd
> be very happy to install it. Or can we simply take all the
> "\e[27;NN,MM~" and add a corresponding "\e[MM;NNu"? If so, I can
> write the patch myself.
Yes, I think so. Maybe this is the better way than checking terminal
capacities and then deciding to enable which format.
/Victor
> Stefan
>> On Wed, Feb 27, 2013 at 9:54 PM, Stefan Monnier <monnier <at> iro.umontreal.ca>wrote:
>>> > When setting "formatOtherKeys" resource to 1 in xterm, 'CSI u'
>>> format is > used for non-standard keycodes. This is also how
>>> mintty support > "modifyOtherKeys" by default.
>>>
>>> > But in term/xterm.el, only 'CSI 27" format is supported.
>>>
>>> > I think it is worth supporting "CSI u" format control
>>> sequences. > What do you think of adding them to
>>> teerm/xterm.el? or anyone can do it?
>>>
>>> I'm not familiar with those "CSI 27" and "CSI u" formats (the
>>> name vaguely reminds me of distant memories, but that's about
>>> it). Could give us an idea of what kind of changes to
>>> term/xterm.el that would entail?
>>>
>>>
>>> Stefan
>>>
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13839
; Package
emacs
.
(Thu, 28 Feb 2013 16:34:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 13839 <at> debbugs.gnu.org (full text, mbox):
>> Y see, that looks fine. If you can prepare a patch for it, I'd
>> be very happy to install it. Or can we simply take all the
>> "\e[27;NN,MM~" and add a corresponding "\e[MM;NNu"? If so, I can
>> write the patch myself.
> Yes, I think so. Maybe this is the better way than checking terminal
> capacities and then deciding to enable which format.
Can you confirm that the patch below works for your formatOtherKeys=1 case?
Stefan
=== modified file 'lisp/term/xterm.el'
--- lisp/term/xterm.el 2013-02-12 17:36:54 +0000
+++ lisp/term/xterm.el 2013-02-28 16:30:30 +0000
@@ -251,120 +251,124 @@
;; These keys are available in xterm starting from version 216
;; if the modifyOtherKeys resource is set to 1.
-
- (define-key map "\e[27;5;9~" [C-tab])
- (define-key map "\e[27;5;13~" [C-return])
- (define-key map "\e[27;5;39~" [?\C-\'])
- (define-key map "\e[27;5;44~" [?\C-,])
- (define-key map "\e[27;5;45~" [?\C--])
- (define-key map "\e[27;5;46~" [?\C-.])
- (define-key map "\e[27;5;47~" [?\C-/])
- (define-key map "\e[27;5;48~" [?\C-0])
- (define-key map "\e[27;5;49~" [?\C-1])
+ (dolist (bind '((5 9 [C-tab])
+ (5 13 [C-return])
+ (5 39 [?\C-\'])
+ (5 44 [?\C-,])
+ (5 45 [?\C--])
+ (5 46 [?\C-.])
+ (5 47 [?\C-/])
+ (5 48 [?\C-0])
+ (5 49 [?\C-1])
;; Not all C-DIGIT keys have a distinct binding.
- (define-key map "\e[27;5;57~" [?\C-9])
- (define-key map "\e[27;5;59~" [?\C-\;])
- (define-key map "\e[27;5;61~" [?\C-=])
- (define-key map "\e[27;5;92~" [?\C-\\])
-
- (define-key map "\e[27;6;33~" [?\C-!])
- (define-key map "\e[27;6;34~" [?\C-\"])
- (define-key map "\e[27;6;35~" [?\C-#])
- (define-key map "\e[27;6;36~" [?\C-$])
- (define-key map "\e[27;6;37~" [?\C-%])
- (define-key map "\e[27;6;38~" [?\C-&])
- (define-key map "\e[27;6;40~" [?\C-(])
- (define-key map "\e[27;6;41~" [?\C-)])
- (define-key map "\e[27;6;42~" [?\C-*])
- (define-key map "\e[27;6;43~" [?\C-+])
- (define-key map "\e[27;6;58~" [?\C-:])
- (define-key map "\e[27;6;60~" [?\C-<])
- (define-key map "\e[27;6;62~" [?\C->])
- (define-key map "\e[27;6;63~" [(control ??)])
-
- ;; These are the strings emitted for various C-M- combinations
- ;; for keyboards that the Meta and Alt modifiers are on the same
- ;; key (usually labeled "Alt").
- (define-key map "\e[27;13;9~" [C-M-tab])
- (define-key map "\e[27;13;13~" [C-M-return])
-
- (define-key map "\e[27;13;39~" [?\C-\M-\'])
- (define-key map "\e[27;13;44~" [?\C-\M-,])
- (define-key map "\e[27;13;45~" [?\C-\M--])
- (define-key map "\e[27;13;46~" [?\C-\M-.])
- (define-key map "\e[27;13;47~" [?\C-\M-/])
- (define-key map "\e[27;13;48~" [?\C-\M-0])
- (define-key map "\e[27;13;49~" [?\C-\M-1])
- (define-key map "\e[27;13;50~" [?\C-\M-2])
- (define-key map "\e[27;13;51~" [?\C-\M-3])
- (define-key map "\e[27;13;52~" [?\C-\M-4])
- (define-key map "\e[27;13;53~" [?\C-\M-5])
- (define-key map "\e[27;13;54~" [?\C-\M-6])
- (define-key map "\e[27;13;55~" [?\C-\M-7])
- (define-key map "\e[27;13;56~" [?\C-\M-8])
- (define-key map "\e[27;13;57~" [?\C-\M-9])
- (define-key map "\e[27;13;59~" [?\C-\M-\;])
- (define-key map "\e[27;13;61~" [?\C-\M-=])
- (define-key map "\e[27;13;92~" [?\C-\M-\\])
-
- (define-key map "\e[27;14;33~" [?\C-\M-!])
- (define-key map "\e[27;14;34~" [?\C-\M-\"])
- (define-key map "\e[27;14;35~" [?\C-\M-#])
- (define-key map "\e[27;14;36~" [?\C-\M-$])
- (define-key map "\e[27;14;37~" [?\C-\M-%])
- (define-key map "\e[27;14;38~" [?\C-\M-&])
- (define-key map "\e[27;14;40~" [?\C-\M-\(])
- (define-key map "\e[27;14;41~" [?\C-\M-\)])
- (define-key map "\e[27;14;42~" [?\C-\M-*])
- (define-key map "\e[27;14;43~" [?\C-\M-+])
- (define-key map "\e[27;14;58~" [?\C-\M-:])
- (define-key map "\e[27;14;60~" [?\C-\M-<])
- (define-key map "\e[27;14;62~" [?\C-\M->])
- (define-key map "\e[27;14;63~" [(control meta ??)])
-
- (define-key map "\e[27;7;9~" [C-M-tab])
- (define-key map "\e[27;7;13~" [C-M-return])
-
- (define-key map "\e[27;7;32~" [?\C-\M-\s])
- (define-key map "\e[27;7;39~" [?\C-\M-\'])
- (define-key map "\e[27;7;44~" [?\C-\M-,])
- (define-key map "\e[27;7;45~" [?\C-\M--])
- (define-key map "\e[27;7;46~" [?\C-\M-.])
- (define-key map "\e[27;7;47~" [?\C-\M-/])
- (define-key map "\e[27;7;48~" [?\C-\M-0])
- (define-key map "\e[27;7;49~" [?\C-\M-1])
- (define-key map "\e[27;7;50~" [?\C-\M-2])
- (define-key map "\e[27;7;51~" [?\C-\M-3])
- (define-key map "\e[27;7;52~" [?\C-\M-4])
- (define-key map "\e[27;7;53~" [?\C-\M-5])
- (define-key map "\e[27;7;54~" [?\C-\M-6])
- (define-key map "\e[27;7;55~" [?\C-\M-7])
- (define-key map "\e[27;7;56~" [?\C-\M-8])
- (define-key map "\e[27;7;57~" [?\C-\M-9])
- (define-key map "\e[27;7;59~" [?\C-\M-\;])
- (define-key map "\e[27;7;61~" [?\C-\M-=])
- (define-key map "\e[27;7;92~" [?\C-\M-\\])
-
- (define-key map "\e[27;8;33~" [?\C-\M-!])
- (define-key map "\e[27;8;34~" [?\C-\M-\"])
- (define-key map "\e[27;8;35~" [?\C-\M-#])
- (define-key map "\e[27;8;36~" [?\C-\M-$])
- (define-key map "\e[27;8;37~" [?\C-\M-%])
- (define-key map "\e[27;8;38~" [?\C-\M-&])
- (define-key map "\e[27;8;40~" [?\C-\M-\(])
- (define-key map "\e[27;8;41~" [?\C-\M-\)])
- (define-key map "\e[27;8;42~" [?\C-\M-*])
- (define-key map "\e[27;8;43~" [?\C-\M-+])
- (define-key map "\e[27;8;58~" [?\C-\M-:])
- (define-key map "\e[27;8;60~" [?\C-\M-<])
- (define-key map "\e[27;8;62~" [?\C-\M->])
- (define-key map "\e[27;8;63~" [(control meta ??)])
-
- (define-key map "\e[27;2;9~" [S-tab])
- (define-key map "\e[27;2;13~" [S-return])
-
- (define-key map "\e[27;6;9~" [C-S-tab])
- (define-key map "\e[27;6;13~" [C-S-return])
+ (5 57 [?\C-9])
+ (5 59 [?\C-\;])
+ (5 61 [?\C-=])
+ (5 92 [?\C-\\])
+
+ (6 33 [?\C-!])
+ (6 34 [?\C-\"])
+ (6 35 [?\C-#])
+ (6 36 [?\C-$])
+ (6 37 [?\C-%])
+ (6 38 [?\C-&])
+ (6 40 [?\C-\(])
+ (6 41 [?\C-\)])
+ (6 42 [?\C-*])
+ (6 43 [?\C-+])
+ (6 58 [?\C-:])
+ (6 60 [?\C-<])
+ (6 62 [?\C->])
+ (6 63 [(control ??)])
+
+ ;; These are the strings emitted for various C-M-
+ ;; combinations for keyboards whose Meta and Alt
+ ;; modifiers are on the same key (usually labeled "Alt").
+ (13 9 [C-M-tab])
+ (13 13 [C-M-return])
+
+ (13 39 [?\C-\M-\'])
+ (13 44 [?\C-\M-,])
+ (13 45 [?\C-\M--])
+ (13 46 [?\C-\M-.])
+ (13 47 [?\C-\M-/])
+ (13 48 [?\C-\M-0])
+ (13 49 [?\C-\M-1])
+ (13 50 [?\C-\M-2])
+ (13 51 [?\C-\M-3])
+ (13 52 [?\C-\M-4])
+ (13 53 [?\C-\M-5])
+ (13 54 [?\C-\M-6])
+ (13 55 [?\C-\M-7])
+ (13 56 [?\C-\M-8])
+ (13 57 [?\C-\M-9])
+ (13 59 [?\C-\M-\;])
+ (13 61 [?\C-\M-=])
+ (13 92 [?\C-\M-\\])
+
+ (14 33 [?\C-\M-!])
+ (14 34 [?\C-\M-\"])
+ (14 35 [?\C-\M-#])
+ (14 36 [?\C-\M-$])
+ (14 37 [?\C-\M-%])
+ (14 38 [?\C-\M-&])
+ (14 40 [?\C-\M-\(])
+ (14 41 [?\C-\M-\)])
+ (14 42 [?\C-\M-*])
+ (14 43 [?\C-\M-+])
+ (14 58 [?\C-\M-:])
+ (14 60 [?\C-\M-<])
+ (14 62 [?\C-\M->])
+ (14 63 [(control meta ??)])
+
+ (7 9 [C-M-tab])
+ (7 13 [C-M-return])
+
+ (7 32 [?\C-\M-\s])
+ (7 39 [?\C-\M-\'])
+ (7 44 [?\C-\M-,])
+ (7 45 [?\C-\M--])
+ (7 46 [?\C-\M-.])
+ (7 47 [?\C-\M-/])
+ (7 48 [?\C-\M-0])
+ (7 49 [?\C-\M-1])
+ (7 50 [?\C-\M-2])
+ (7 51 [?\C-\M-3])
+ (7 52 [?\C-\M-4])
+ (7 53 [?\C-\M-5])
+ (7 54 [?\C-\M-6])
+ (7 55 [?\C-\M-7])
+ (7 56 [?\C-\M-8])
+ (7 57 [?\C-\M-9])
+ (7 59 [?\C-\M-\;])
+ (7 61 [?\C-\M-=])
+ (7 92 [?\C-\M-\\])
+
+ (8 33 [?\C-\M-!])
+ (8 34 [?\C-\M-\"])
+ (8 35 [?\C-\M-#])
+ (8 36 [?\C-\M-$])
+ (8 37 [?\C-\M-%])
+ (8 38 [?\C-\M-&])
+ (8 40 [?\C-\M-\(])
+ (8 41 [?\C-\M-\)])
+ (8 42 [?\C-\M-*])
+ (8 43 [?\C-\M-+])
+ (8 58 [?\C-\M-:])
+ (8 60 [?\C-\M-<])
+ (8 62 [?\C-\M->])
+ (8 63 [(control meta ??)])
+
+ (2 9 [S-tab])
+ (2 13 [S-return])
+
+ (6 9 [C-S-tab])
+ (6 13 [C-S-return])))
+ (define-key map
+ (format "\e[27;%d;%d~" (nth 0 bind) (nth 1 bind)) (nth 2 bind))
+ ;; For formatOtherKeys=1, the sequence is a bit shorter (bug#13839).
+ (define-key map
+ (format "\e[%d;%du" (nth 1 bind) (nth 0 bind)) (nth 2 bind)))
;; Other versions of xterm might emit these.
(define-key map "\e[A" [up])
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13839
; Package
emacs
.
(Fri, 01 Mar 2013 15:18:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 13839 <at> debbugs.gnu.org (full text, mbox):
On Fri, Mar 1, 2013 at 12:31 AM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>
> >> Y see, that looks fine. If you can prepare a patch for it, I'd
> >> be very happy to install it. Or can we simply take all the
> >> "\e[27;NN,MM~" and add a corresponding "\e[MM;NNu"? If so, I can
> >> write the patch myself.
> > Yes, I think so. Maybe this is the better way than checking terminal
> > capacities and then deciding to enable which format.
>
> Can you confirm that the patch below works for your formatOtherKeys=1 case?
There is no problem in the patch itself. But the xterm extra capability support
does not work automatically due to another bug in lisp/term/xterm.el -
the regexp in line 532 ">0;\\([0-9]+\\);0". It should be
">[0-9]+;\\([0-9]+\\);0".
The number before the first semi-colon could be many different values, according
to http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
section "Send Device Attributes (Secondary DA)":
P p = 0 → ‘‘VT100’’.
P p = 1 → ‘‘VT220’’.
P p = 2 → ‘‘VT240’’.
P p = 1 8 → ‘‘VT330’’.
P p = 1 9 → ‘‘VT340’’.
P p = 2 4 → ‘‘VT320’’.
P p = 4 1 → ‘‘VT420’’.
P p = 6 1 → ‘‘VT510’’.
P p = 6 4 → ‘‘VT520’’.
P p = 6 5 → ‘‘VT525’’.
The default value is 41 (in xterm latest version manual).
Would you fix this bug by the way?
> Stefan
BR/
Victor Ren
>
> === modified file 'lisp/term/xterm.el'
> --- lisp/term/xterm.el 2013-02-12 17:36:54 +0000
> +++ lisp/term/xterm.el 2013-02-28 16:30:30 +0000
> @@ -251,120 +251,124 @@
>
> ;; These keys are available in xterm starting from version 216
> ;; if the modifyOtherKeys resource is set to 1.
> -
> - (define-key map "\e[27;5;9~" [C-tab])
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13839
; Package
emacs
.
(Mon, 11 Mar 2013 18:27:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 13839 <at> debbugs.gnu.org (full text, mbox):
>> Can you confirm that the patch below works for your formatOtherKeys=1 case?
> There is no problem in the patch itself.
Thanks, installed.
> But the xterm extra capability support
> does not work automatically due to another bug in lisp/term/xterm.el -
> the regexp in line 532 ">0;\\([0-9]+\\);0". It should be
> ">[0-9]+;\\([0-9]+\\);0".
Hmm...
> The default value is 41 (in xterm latest version manual).
It seems that indeed the regexp could need revision, but I'd first like
to understand what's going on. The test we want to make is "make sure
this terminal understands this and that feature". So the "P v" field
(the version number) only makes sense if the terminal is actually an
xterm (or uses a version numbering that implies the same featureset).
In my xterms the "P p" value is always 0 and not 41 as you seem to suggest.
More specifically, I'm concerned that by accepting any "P p" number, we
might end up trying to use a feature that's not supported by the
underlying terminal emulator because it happens to have version numbers
that are higher than those of "the usual xterm".
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13839
; Package
emacs
.
(Tue, 12 Mar 2013 08:06:03 GMT)
Full text and
rfc822 format available.
Message #17 received at 13839 <at> debbugs.gnu.org (full text, mbox):
On Mon, Mar 11, 2013 at 7:25 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>
> >> Can you confirm that the patch below works for your formatOtherKeys=1 case?
> > There is no problem in the patch itself.
>
> Thanks, installed.
>
> > But the xterm extra capability support
> > does not work automatically due to another bug in lisp/term/xterm.el -
> > the regexp in line 532 ">0;\\([0-9]+\\);0". It should be
> > ">[0-9]+;\\([0-9]+\\);0".
>
> Hmm...
>
> > The default value is 41 (in xterm latest version manual).
>
> It seems that indeed the regexp could need revision, but I'd first like
> to understand what's going on. The test we want to make is "make sure
> this terminal understands this and that feature". So the "P v" field
> (the version number) only makes sense if the terminal is actually an
> xterm (or uses a version numbering that implies the same featureset).
> In my xterms the "P p" value is always 0 and not 41 as you seem to suggest.
I checked the changelog of xterm. There is one item in Patch #280:
change default emulation level to VT420 (discussion with Ailin Nemui).
http://invisible-island.net/xterm/xterm.log.html#xterm_280
Anyway, "Pp" value can be configured to several values.
Emacs get the terminal type from environment variable "TERM" I don't
think "Pp" value is relevant.
BR
Victor Ren
>
> More specifically, I'm concerned that by accepting any "P p" number, we
> might end up trying to use a feature that's not supported by the
> underlying terminal emulator because it happens to have version numbers
> that are higher than those of "the usual xterm".
>
>
> Stefan
Reply sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
You have taken responsibility.
(Tue, 08 Jul 2014 18:55:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
bug acknowledged by developer.
(Tue, 08 Jul 2014 18:55:04 GMT)
Full text and
rfc822 format available.
Message #22 received at 13839-done <at> debbugs.gnu.org (full text, mbox):
>> > The default value is 41 (in xterm latest version manual).
>>
>> It seems that indeed the regexp could need revision, but I'd first like
>> to understand what's going on. The test we want to make is "make sure
>> this terminal understands this and that feature". So the "P v" field
>> (the version number) only makes sense if the terminal is actually an
>> xterm (or uses a version numbering that implies the same featureset).
>> In my xterms the "P p" value is always 0 and not 41 as you seem to suggest.
In the mean time, we've indeed changed this regexp to accept other
numbers as well, and sure enough this bumped into new bugs with
non-xterm terminals, and we've hacked our way around those as well.
So I think this can be closed now. Thank you,
Stefan
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 06 Aug 2014 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 322 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.