From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#13839: xterm/mintty control sequences support when formatOtherKeys = 1 Date: Thu, 28 Feb 2013 11:31:17 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1362069138 29121 80.91.229.3 (28 Feb 2013 16:32:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Feb 2013 16:32:18 +0000 (UTC) Cc: Victor Ren To: 13839@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 28 17:32:39 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UB6PP-0004bQ-06 for geb-bug-gnu-emacs@m.gmane.org; Thu, 28 Feb 2013 17:32:39 +0100 Original-Received: from localhost ([::1]:36385 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UB6P3-0001i4-UV for geb-bug-gnu-emacs@m.gmane.org; Thu, 28 Feb 2013 11:32:17 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:59684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UB6Oy-0001hb-EX for bug-gnu-emacs@gnu.org; Thu, 28 Feb 2013 11:32:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UB6Os-00019S-Gk for bug-gnu-emacs@gnu.org; Thu, 28 Feb 2013 11:32:12 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UB6Os-00019I-BH for bug-gnu-emacs@gnu.org; Thu, 28 Feb 2013 11:32:06 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UB6Qk-0002cJ-Fc for bug-gnu-emacs@gnu.org; Thu, 28 Feb 2013 11:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Feb 2013 16:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13839 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13839-submit@debbugs.gnu.org id=B13839.136206921510021 (code B ref 13839); Thu, 28 Feb 2013 16:34:02 +0000 Original-Received: (at 13839) by debbugs.gnu.org; 28 Feb 2013 16:33:35 +0000 Original-Received: from localhost ([127.0.0.1]:56395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UB6QH-0002bY-Gy for submit@debbugs.gnu.org; Thu, 28 Feb 2013 11:33:34 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:10089) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UB6QE-0002bR-Oy for 13839@debbugs.gnu.org; Thu, 28 Feb 2013 11:33:31 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFFpaTU/2dsb2JhbABEuzWDWRdzgh4BAQQBJy8jEAs0EhQYDYhCBsEtgkqOQAOIYZwZgV6DFQ X-IPAS-Result: Av8EABK/CFFFpaTU/2dsb2JhbABEuzWDWRdzgh4BAQQBJy8jEAs0EhQYDYhCBsEtgkqOQAOIYZwZgV6DFQ X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="2695059" Original-Received: from 69-165-164-212.dsl.teksavvy.com (HELO pastel.home) ([69.165.164.212]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 28 Feb 2013 11:31:32 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id C63516BDCD; Thu, 28 Feb 2013 11:31:17 -0500 (EST) In-Reply-To: (Stefan Monnier's message of "Thu, 28 Feb 2013 10:42:47 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:71953 Archived-At: >> 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])