From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Pascal Bourguignon Newsgroups: gmane.emacs.help Subject: Re: How to make work with in xterm? Date: Sat, 14 Oct 2006 08:00:39 +0200 Organization: Informatimago Message-ID: <87y7rj8mig.fsf@thalassa.informatimago.com> References: <1160802062.842063.186330@i42g2000cwa.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1160808033 18299 80.91.229.2 (14 Oct 2006 06:40:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 14 Oct 2006 06:40:33 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Oct 14 08:40:30 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GYdC6-000187-5X for geh-help-gnu-emacs@m.gmane.org; Sat, 14 Oct 2006 08:40:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GYdC5-0000uv-OJ for geh-help-gnu-emacs@m.gmane.org; Sat, 14 Oct 2006 02:40:25 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news4.google.com!news2.volia.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 91 Original-X-Trace: individual.net f4Wiysd3HNKlBLHuqVPwsweRhpq2qOiA5mbmYaTcLmU5SIKE8w Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:Gx3caQMFHAEw6hKNBypHRDL6OUY= Original-Xref: shelby.stanford.edu gnu.emacs.help:142402 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:38023 Archived-At: id.brep@gmail.com writes: > In the emacs manual, it's said: > > On ASCII terminals, there are only 32 possible control characters. > These are the control variants of letters and `@[]\^_'. In addition, > the shift key is meaningless with control characters: `C-a' and `C-A' > are the same character, and Emacs cannot distinguish them. > > I use xterm, I think it's graphical terminal, is it possibleto make > > work with in xterm? Not AFAIK. The question is that there is no line protocol to encode shit+control+key. There is the ASCII code, with 33 control codes and 95 character codes. Unshifted, we get characters between 32 and 47, and between 96 and 127. The shift key is used to get the characters between 48 and 95. The control key is used to get the control codes between 0 and 31. So we only need 32 keys in addition to shift and control to generate all the ASCII codes. 0 NUL 1 SOH 2 STX 3 ETX 4 EOT 5 ENQ 6 ACK 7 BEL 8 BS 9 TAB 10 LF 11 VT 12 FF 13 CR 14 SO 15 SI 16 DLE 17 DC1 18 DC2 19 DC3 20 DC4 21 NAK 22 SYN 23 ETB 24 CAN 25 EM 26 SUB 27 ESC 28 FS 29 GS 30 RS 31 US 32 SP 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W 88 X 89 Y 90 Z 91 [ 92 \ 93 ] 94 ^ 95 _ 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 DEL For Meta, we have the choice to use the old protocol, prefixing the key with escape (ESC, code 27), or the new one, setting the high bit on the 7-bit ASCII code. But this doesn't work well with iso-8859-1 keyboards, so we still often map Meta to ESC... Apart from Meta sent as ESC, there's no protocol to encode the other modifiers. We just send normal ASCII codes. On the other side, emacs takes the ASCII codes and guess that some modifier keys were pressed along with some character key. But of course, since there are not 64 control code, it can only man C-x, not C-S-x (C-X). What could be done, is to define a protocol to encode and transmit all the X keysyms thru a serial line, and patch xterm to use it. Or we could design a ad-hoc encoding scheme where: Escape = 1 Control = 2 Meta = 4 Alt = 8 Shift = 16 super = 32 Hyper = 64 And a key choard would be encoded as CAN(24) c(99) with being the sum of the codes of the modifier keys that are pressed, and being the ASCII code of the graphic character. So when you'd type C-M-S-x, xterm would send: 24 99 22 120 This would be interpreted by emacs as: C-x c C-v x and it could be bound to a distinct command from a keymap for C-x c. Or we could patch emacs to decode the protocol and translate the two bytes following a C-x c into the corresponding key events. -- __Pascal Bourguignon__ http://www.informatimago.com/ "You can tell the Lisp programmers. They have pockets full of punch cards with close parentheses on them." --> http://tinyurl.com/8ubpf