all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to make <shift> work with <control> in xterm?
@ 2006-10-14  5:01 id.brep
  2006-10-14  6:00 ` Pascal Bourguignon
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: id.brep @ 2006-10-14  5:01 UTC (permalink / raw)


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
<shit>
work with <control> in xterm?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to make <shift> work with <control> in xterm?
  2006-10-14  5:01 How to make <shift> work with <control> in xterm? id.brep
@ 2006-10-14  6:00 ` Pascal Bourguignon
  2006-10-14  8:43   ` id.brep
  2006-10-14 12:05   ` dickey
  2006-10-14  7:06 ` Harald Hanche-Olsen
  2006-10-14 18:40 ` Ilya Zakharevich
  2 siblings, 2 replies; 6+ messages in thread
From: Pascal Bourguignon @ 2006-10-14  6:00 UTC (permalink / raw)


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
> <shit>
> work with <control> 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) <modifiers> <character>

with <modifiers> being the sum of the codes of the modifier keys that
are pressed, and  <character> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to make <shift> work with <control> in xterm?
  2006-10-14  5:01 How to make <shift> work with <control> in xterm? id.brep
  2006-10-14  6:00 ` Pascal Bourguignon
@ 2006-10-14  7:06 ` Harald Hanche-Olsen
  2006-10-14 18:40 ` Ilya Zakharevich
  2 siblings, 0 replies; 6+ messages in thread
From: Harald Hanche-Olsen @ 2006-10-14  7:06 UTC (permalink / raw)


+ id.brep@gmail.com:

| I use xterm, I think it's graphical terminal, is it possibleto make
| <shit>
| work with <control> in xterm?

There is no need.  <shit> happens.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to make <shift> work with <control> in xterm?
  2006-10-14  6:00 ` Pascal Bourguignon
@ 2006-10-14  8:43   ` id.brep
  2006-10-14 12:05   ` dickey
  1 sibling, 0 replies; 6+ messages in thread
From: id.brep @ 2006-10-14  8:43 UTC (permalink / raw)



Pascal Bourguignon writes:

> Not AFAIK.
> The question is that there is no line protocol to encode shit+control+key.

Thanks for your explanation.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to make <shift> work with <control> in xterm?
  2006-10-14  6:00 ` Pascal Bourguignon
  2006-10-14  8:43   ` id.brep
@ 2006-10-14 12:05   ` dickey
  1 sibling, 0 replies; 6+ messages in thread
From: dickey @ 2006-10-14 12:05 UTC (permalink / raw)


Pascal Bourguignon wrote:
> id.brep@gmail.com writes:
> > I use xterm, I think it's graphical terminal, is it possibleto make
> > <shit>
> > work with <control> in xterm?
>
> Not AFAIK.
>
> The question is that there is no line protocol to encode shit+control+key.

xterm has an experimental feature for this (three levels, where the
intermediate level
may change, but the third addresses this in part).  See
"modifyOtherKeys" in patches
214-216:

http://invisible-island.net/xterm/xterm.log.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to make <shift> work with <control> in xterm?
  2006-10-14  5:01 How to make <shift> work with <control> in xterm? id.brep
  2006-10-14  6:00 ` Pascal Bourguignon
  2006-10-14  7:06 ` Harald Hanche-Olsen
@ 2006-10-14 18:40 ` Ilya Zakharevich
  2 siblings, 0 replies; 6+ messages in thread
From: Ilya Zakharevich @ 2006-10-14 18:40 UTC (permalink / raw)


[A complimentary Cc of this posting was sent to

<id.brep@gmail.com>], who wrote in article <1160802062.842063.186330@i42g2000cwa.googlegroups.com>:
> 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
> <shit>
> work with <control> in xterm?

With special keys, it should work out-of-the-box (with sufficiently
new xterm) [of course, Emacs is (was?) too stupid to support keys with
modifiers out-of-the box; if current one is still that stupid, see
ilyaz.org/software/emacs, look for `key' `modifier' in customization files].

With ASCII key, if Thomas suggestion on modify-other-keys does not
help, you may want to add xterm keybindings which would send, e.g.,
C-x @ c A for C-S-a etc.

Hope this helps,
Ilya

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-10-14 18:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-14  5:01 How to make <shift> work with <control> in xterm? id.brep
2006-10-14  6:00 ` Pascal Bourguignon
2006-10-14  8:43   ` id.brep
2006-10-14 12:05   ` dickey
2006-10-14  7:06 ` Harald Hanche-Olsen
2006-10-14 18:40 ` Ilya Zakharevich

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.