From:	CRDGW2::CRDGW2::MRGATE::"SMTP::PREP.AI.MIT.EDU::INFO-GNU-EMACS-REQUEST" 28-JUN-1989 18:24
To:	MRGATE::"ARISIA::EVERHART"
Subj:	Re: Suggested new X11 function key keybindings

Received: by life.ai.mit.edu (4.0/AI-4.10) id AA01468; Wed, 28 Jun 89 14:47:15 EDT
Return-Path: <info-gnu-emacs-request@prep.ai.mit.edu>
Received: from tut.cis.ohio-state.edu by life.ai.mit.edu (4.0/AI-4.10) id AA01371; Wed, 28 Jun 89 14:42:54 EDT
Received: by tut.cis.ohio-state.edu (5.59/4.890612)
	id AA11767; Wed, 28 Jun 89 14:40:19 EDT
Received: from USENET by tut.cis.ohio-state.edu with netnews
	for info-gnu-emacs@prep.ai.mit.edu (info-gnu-emacs@prep.ai.mit.edu)
	(contact usenet@tut.cis.ohio-state.edu if you have questions)
Date: 28 Jun 89 18:13:18 GMT
From: daemon@jarvis.csri.toronto.edu  (Chris Siebenmann)
Organization: Ziebmef home away from home
Subject: Re: Suggested new X11 function key keybindings
Message-Id: <89Jun28.141325edt.30767@snow.white.toronto.edu>
References: <89Jun26.174823edt.30767@snow.white.toronto.edu>
Sender: info-gnu-emacs-request@prep.ai.mit.edu
To: info-gnu-emacs@prep.ai.mit.edu


 Oops, as they say. It has been pointed out to me that the patches I
posted had explicit escape characters in them which got swallowed up
by our news software. Here's a corrected patch; apply this one INSTEAD
of the previous patch.

*** x11term.c.orig	Fri Feb 24 16:44:00 1989
--- x11term.c	Wed Jun 28 14:03:00 1989
***************
*** 1055,1211
   * from elisp.
   */
  
- #ifdef sun
- char *stringFuncVal(keycode)
- 	KeySym keycode;
- {
- 	switch (keycode) {
- 	case XK_L1:
- 		return("192");
- 	case XK_L2:
- 		return("193");
- 	case XK_L3:
- 		return("194");
- 	case XK_L4:
- 		return("195");
- 	case XK_L5:
- 		return("196");
- 	case XK_L6:
- 		return("197");
- 	case XK_L7:
- 		return("198");
- 	case XK_L8:
- 		return("199");
- 	case XK_L9:
- 		return("200");
- 	case XK_L10:
- 		return("201");
- 
- 	case XK_R1:
- 		return("208");
- 	case XK_R2:
- 		return("209");
- 	case XK_R3:
- 		return("210");
- 	case XK_R4:
- 		return("211");
- 	case XK_R5:
- 		return("212");
- 	case XK_R6:
- 		return("213");
- 	case XK_R7:
- 		return("214");
- 	case XK_R8:
- 		return("215");
- 	case XK_R9:
- 		return("216");
- 	case XK_R10:
- 		return("217");
- 	case XK_R11:
- 		return("218");
- 	case XK_R12:
- 		return("219");
- 	case XK_R13:
- 		return("220");
- 	case XK_R14:
- 		return("221");
- 	case XK_R15:
- 		return("222");
- 
- 	case XK_Break:			/* Sun3 "Alternate" key */
- 		return("223");
- 
- 	case XK_F1:
- 		return("224");
- 	case XK_F2:
- 		return("225");
- 	case XK_F3:
- 		return("226");
- 	case XK_F4:
- 		return("227");
- 	case XK_F5:
- 		return("228");
- 	case XK_F6:
- 		return("229");
- 	case XK_F7:
- 		return("230");
- 	case XK_F8:
- 		return("231");
- 	case XK_F9:
- 		return("232");
- 
- 	default:
- 		return("-1");
- 	}
- }
- #else
- char *stringFuncVal(keycode)
- 	KeySym keycode;
- {
- 	switch (keycode) {
- 	case XK_F1:
- 		return("11");
- 	case XK_F2:
- 		return("12");
- 	case XK_F3:
- 		return("13");
- 	case XK_F4:
- 		return("14");
- 	case XK_F5:
- 		return("15");
- 	case XK_F6:
- 		return("17");
- 	case XK_F7:
- 		return("18");
- 	case XK_F8:
- 		return("19");
- 	case XK_F9:
- 		return("20");
- 	case XK_F10:
- 		return("21");
- 	case XK_F11:
- 		return("23");
- 	case XK_F12:
- 		return("24");
- 	case XK_F13:
- 		return("25");
- 	case XK_F14:
- 		return("26");
- 	case XK_F15:
- 		return("28");
- 	case XK_Help:
- 		return("28");
- 	case XK_F16:
- 		return("29");
- 	case XK_Menu:
- 		return("29");
- 	case XK_F17:
- 		return("31");
- 	case XK_F18:
- 		return("32");
- 	case XK_F19:
- 		return("33");
- 	case XK_F20:
- 		return("34");
- 	
- 	case XK_Find :
- 		return("1");
- 	case XK_Insert:
- 		return("2");
- 	case XK_Delete:
- 		return("3");
- 	case XK_Select:
- 		return("4");
- 	case XK_Prior:
- 		return("5");
- 	case XK_Next:
- 		return("6");
- 	default:
- 		return("-1");
- 	}
- }
- #endif /* not sun */
- 	
  internal_socket_read(bufp, numchars)
  	register unsigned char *bufp;
  	register int numchars;

--- 1055,1060 -----
   * from elisp.
   */
  
  internal_socket_read(bufp, numchars)
  	register unsigned char *bufp;
  	register int numchars;
***************
*** 1324,1344
        nbytes = XLookupString (&event,
  			      mapping_buf, 20, &keysym,
  			      &status);
!       /* Someday this will be unnecessary as we will
! 	 be able to use XRebindKeysym so XLookupString
! 	 will have already given us the string we want. */
!       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");

--- 1173,1189 -----
        nbytes = XLookupString (&event,
  			      mapping_buf, 20, &keysym,
  			      &status);
!       /* If XLookupString knows a string for this buffer, or the key
! 	 doesn't have a symbol, or the key is a modifier key (like shift)
! 	 we take it as-is. Otherwise, we take what XKeysymToString gives
! 	 us with a ESC-[ on front and a ~ on the end. If XKeysymToString
! 	 gives us nothing, we use the hex code instead. */
!       if (nbytes == 0 && keysym != NoSymbol && !IsModifierKey(keysym)) {
! 	char *ksname;
! 
! #ifndef	NOCURSORHACK
! 	/* This shouldn't really be needed, but the great god Backwards
! 	   Compatability dictates that we do this. */
  	switch (keysym) {
  	case XK_Left:
  	  strcpy(mapping_buf,"\002");
***************
*** 1356,1361
  	  strcpy(mapping_buf,"\016");
  	  nbytes = 1;
  	  break;
  	}
        }
        if (nbytes) {

--- 1201,1218 -----
  	  strcpy(mapping_buf,"\016");
  	  nbytes = 1;
  	  break;
+ 	default:
+ #endif
+ 	  ksname = XKeysymToString (keysym);
+ 	  if (ksname == NULL)
+ 	    sprintf(mapping_buf, "\033[%x~", keysym);
+ 	  else {
+ 	    strcpy(mapping_buf, "\033[");
+ 	    strcat(mapping_buf, ksname);
+ 	    strcat(mapping_buf, "~");	/* none of this sun oddity BS */
+ 	  }
+ 	  nbytes = strlen(mapping_buf);
+ #ifndef	NOCURSORHACK
  	}
  #endif
        }
***************
*** 1357,1362
  	  nbytes = 1;
  	  break;
  	}
        }
        if (nbytes) {
  	if (event.xkey.state & Mod1Mask)

--- 1214,1220 -----
  	  nbytes = strlen(mapping_buf);
  #ifndef	NOCURSORHACK
  	}
+ #endif
        }
        if (nbytes) {
  	if (event.xkey.state & Mod1Mask)

-- 
	"I shall clasp my hands together and bow to the corners of the world."
			Number Ten Ox, "Bridge of Birds"
Chris Siebenmann		...!utgpu!{ncrcan,ontmoh!moore}!ziebmef!cks
cks@white.toronto.edu	     or ...!utgpu!{,csri!}cks
