[gnu.emacs.bug] Rebinding Arrow Keys

clamen@CLAMEN.AVALON.CS.CMU.EDU (Stewart Clamen) (04/26/89)

One of my users has rebound ^F, but wants the rightarrow key to still
map to 'forward-char.  Problem is, the GNU Emacs/X interface
translates the arrow keys DIRECTLY into ^F/^B/^P/^N.  Here's the code,
from internal_socket_read() in src/x11term.c .

-----
      if (IsFunctionKey(keysym) ||
	  IsMiscFunctionKey(keysym)) {
	strcpy(mapping_buf,"[");
	strcat(mapping_buf,stringFuncVal(keysym));
#ifdef sun
	strcat(mapping_buf,"z");
#else
	strcat(mapping_buf,"~");
#endif /* sun */
	nbytes = strlen(mapping_buf);
      }
      else {
	switch (keysym) {
	case XK_Left:
	  strcpy(mapping_buf,"\002");
	  nbytes = 1;
	  break;
	case XK_Right:
	  strcpy(mapping_buf,"\006");
	  nbytes = 1;
	  break;
	case XK_Up:
	  strcpy(mapping_buf,"\020");
	  nbytes = 1;
	  break;
	case XK_Down:
	  strcpy(mapping_buf,"\016");
	  nbytes = 1;
	  break;
	}
      }

-----

A similar thing is done in the X10 support (src/xterm.c).  I realize
that an easy fix would be to remove the test and map all non-standard
keys to the funny escape sequences.  Any opinions on whether this is a
good thing to do?
--
------------------------------------------------------------------------------
Stewart M. Clamen
School of Computer Science, Carnegie Mellon University
Pittsburgh, PA 15213-3890

INTERNET: clamen@CS.CMU.EDU
USENET:   ...!uunet!"clamen@cs.cmu.edu"

-- 

piet@cs.ruu.nl (Piet van Oostrum) (04/27/89)

In article <CLAMEN.89Apr25184123@CLAMEN.AVALON.CS.CMU.EDU>, clamen@CLAMEN (Stewart Clamen) writes:
 `
 `One of my users has rebound ^F, but wants the rightarrow key to still
 `map to 'forward-char.  Problem is, the GNU Emacs/X interface
 `translates the arrow keys DIRECTLY into ^F/^B/^P/^N.  Here's the code,
 `from internal_socket_read() in src/x11term.c .
 `
 `-----
 `      if (IsFunctionKey(keysym) ||
 `	  IsMiscFunctionKey(keysym)) {
 `	strcpy(mapping_buf,"[");
 `	strcat(mapping_buf,stringFuncVal(keysym));
 `#ifdef sun
 `	strcat(mapping_buf,"z");
 `#else
 `	strcat(mapping_buf,"~");
 `#endif /* sun */

Another problem that I have with this code is that it binds the function
keys to "^[[..." which is difficult to use as "^[[" is not a prefix.

Also some other keys cannot be used, they are simply thrown away.
-- 
Piet van Oostrum, Dept of Computer Science, University of Utrecht
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands
Telephone: +31-30-531806. piet@cs.ruu.nl (mcvax!hp4nl!ruuinf!piet)