[comp.unix.sysv386] Keypad defs' for EMACS under AT386 terminal type..????

geoff@vax1.mankato.msus.edu (04/28/91)

Hello,  

	Is there anyone out there that has a set of keypad/function key
definitions for gnuEMACS that will take advantage of the AT386 terminal type
and allow you to among other things use the arrow keys on the keyboard??

If it would be possible I would like a copy of anyones that has it up and
running(working).  

thanks
-geoff

--------------------------------------------------------------------------------
  **				Geoff Kuchera 
*   *			
*     			     A-427 Crawford Hall 
*  ** **    **		      Mankato, MN 56001
  **   *  *		       (507) 389-1691
       ***                            
       *   *                                          
      **    **	    Internet: Geoff@Vax1.Mankato.MSUS.EDU
			      geoff@att1.mankato.MSUS.edu            
--------------------------------------------------------------------------------

dave@jato.jpl.nasa.gov (Dave Hayes) (04/30/91)

geoff@vax1.mankato.msus.edu writes:

>Hello,  

>	Is there anyone out there that has a set of keypad/function key
>definitions for gnuEMACS that will take advantage of the AT386 terminal type
>and allow you to among other things use the arrow keys on the keyboard??

I have one HOWEVER I am reluctant to release it for general use until I
find out exactly how to stop an ESC from being eaten by a search command.

The problem is, let's say you do a search...and then failing to find 
anything you want to use the cursor keys. The darn thing eats the ESC
character (I think it wants to use that character to signify end of 
searching) and then the rest of the keycode shows gleefully up in
your edited file. 

So (noting the Followup-To line) if anyone has any authoritative or 
informative ideas on how to fix this (or if it is even fixable) then
I'll post or mail or whatever is appropriate my AT386.el file.
-- 
Dave Hayes - Network & Communications Engineering - JPL / NASA - Pasadena CA
dave@elxr.jpl.nasa.gov       dave@jato.jpl.nasa.gov           ames!elroy!dxh

A person was frighteningly ugly. Once he was asked how could he go on
living with such a terrible face. "Why should I be unhappy?", answered
the man. "I never see my own face; let others worry."

jim@segue.segue.com (Jim Balter) (05/02/91)

In article <1991Apr29.204040.14429@jato.jpl.nasa.gov> dave@elxr.jpl.nasa.gov writes:
>The problem is, let's say you do a search...and then failing to find 
>anything you want to use the cursor keys. The darn thing eats the ESC
>character (I think it wants to use that character to signify end of 
>searching) and then the rest of the keycode shows gleefully up in
>your edited file. 

Given the way that GNU emacs handles keys and key maps, I don't think there's
anything you can do about this.  Incremental search interprets keys at a level
lower than the key map, so it will see your arrow or function keys as a series
of keystrokes.

Here's the at386.el that we use here:

;; Map AT386 function key escape sequences
;; into the standard slots in function-keymap where we can;
;; set up terminal-specific bindings where we must
;;
;; by: JQB, adapted from s4.el

(require 'keypad)

;; First, map as many keys as possible to terminal-independent keycaps

(defvar META-RB-map nil
  "The META-RB-map maps the ESC-[ function keys on the AT386 keyboard.")

(if (not META-RB-map)
    (progn
     (setq META-RB-map (lookup-key global-map "\e["))
     (if (not (keymapp META-RB-map))
	 (setq META-RB-map (make-sparse-keymap)))  ;; <ESC>[ commands

     (setup-terminal-keymap META-RB-map '(
	      ("A" . ?u)	   ; up arrow
	      ("B" . ?d)	   ; down-arrow
	      ("C" . ?r)	   ; right-arrow
	      ("D" . ?l)	   ; left-arrow
	      ("U" . ?N)	   ; 'Page' -> next page
	      ("V" . ?P)	   ; 'Shift-Page' -> prev page
	      ("H" . ?h)	   ; 'Home' -> home-key
	      ("@" . ?I)	   ; 'Ins' -> insert character key
	      ("G" . ?5)	   ; keypad 5
	      ("S" . ?-)	   ; keypad -
	      ("T" . ?+)	   ; keypad +
	      ("Y" . ?n)	   ; 'End' (no standard, use n)
	))

     (global-set-key "\e[" META-RB-map)))

(defvar META-O-map nil
  "META-O-map maps the META-O function keys on the AT386 keyboard.")

(if (not META-O-map)
    (progn

     (setq META-O-map (lookup-key global-map "\eO"))
     (if (not (keymapp META-O-map))
	 (setq META-O-map (make-sparse-keymap)))  ;; <ESC>O commands
     (setup-terminal-keymap META-O-map '(
		("P" . ?\C-a)	; 'F1' -> function key 1
		("Q" . ?\C-b)	; 'F2' -> function key 2
		("R" . ?\C-c)	; 'F3' -> function key 3
		("S" . ?\C-d)	; 'F4' -> function key 4
		("T" . ?\C-e)	; 'F5' -> function key 5
		("U" . ?\C-f)	; 'F6' -> function key 6
		("V" . ?\C-g)	; 'F7' -> function key 7
		("W" . ?\C-h)	; 'F8' -> function key 8
		("X" . ?\C-i)	; 'F9' -> function key 9
		("Y" . ?\C-j)	; 'F10' -> function key 10
		("Z" . ?\C-k)	; 'F11' -> function key 11
		("A" . ?\C-l)	; 'F12' -> function key 12
	))

     (define-key global-map "\eO" META-O-map)))

leo@aai.com (05/03/91)

I replied by mail, but thought this might be of general interest.

>geoff@vax1.mankato.msus.edu writes:

>>Hello,  

>>	Is there anyone out there that has a set of keypad/function key
>>definitions for gnuEMACS that will take advantage of the AT386 terminal type
>>and allow you to among other things use the arrow keys on the keyboard??

>I have one HOWEVER I am reluctant to release it for general use until I
>find out exactly how to stop an ESC from being eaten by a search command.

>The problem is, let's say you do a search...and then failing to find 
>anything you want to use the cursor keys. The darn thing eats the ESC
>character (I think it wants to use that character to signify end of 
>searching) and then the rest of the keycode shows gleefully up in
>your edited file. 

>So (noting the Followup-To line) if anyone has any authoritative or 
>informative ideas on how to fix this (or if it is even fixable) then
>I'll post or mail or whatever is appropriate my AT386.el file.
>-- 

This is the way it is intended and documented as working.  Incremental
searches in progress can be extended to include additional characters by
just typing them in.  So, a special character is needed to indicate that
you wish to end the search rather than add characters to the search string.
There are several ways to indicate that you are done searching:

	1) hitting the escape key
	2) hitting the abort key (^G)
	3) any movement command not starting with escape

I usually hit an ^A (beginning of line) or ^G to end a search.  If you
forget, just use ^X-U (undo) to remove the garbage.

-- 
Leo	leo@aai.com   leo%aai@uunet.uu.net   ...uunet!aai!leo