Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!dialogic!drich From: drich@dialogic.UUCP (Dan Rich) Newsgroups: comp.unix.i386 Subject: Re: Emacs key bindings for Interactive at386 console Keywords: at386.el Message-ID: <999@dialogic.UUCP> Date: 29 Nov 89 19:47:42 GMT References: <2970@uceng.UC.EDU> Reply-To: drich@dialogic.UUCP (Dan Rich) Organization: Dialogic Corp., Parsippany, NJ Lines: 143 Below you will find a copy of my term/at386.el file. This binds the keypad on an at386 terminal to the obvious definitions, F1 to help, and also C-? to help (due to a conflict with F1 and another mode I am working on). The only "feature" of this that might be surprising is the working of the home/end keys. I have written these to be compatable with a version of BRIEF that we use, and they act as follows: Pressing home/end once: beginning/end of line twice: beginning/end of screen three times: beginning/end of file This file will also remove C-h from help (backspace conflict), and remap this to C-? (formerly undo). I chose this because undo also can be found on C-x u, and C-? is almost intuitive... Dan Rich | ARPA: drich%dialogic@uunet.uu.net UNIX Systems Administrator | UUCP: uunet!dialogic!drich Dialogic Corporation | - Time is an illusion. Lunchtime, doubly so. - (201) 334-8450 x213 | Douglas Adams 8<------------------------------ Cut Here ------------------------------>8 ;;; $Id: at386.el,v 1.2 89/09/14 11:44:32 drich Exp $ ;;; ;;; at386 keyboard definitions ;;; Dan Rich (drich@dialogic.UUCP) ;;; 21 August 1989 ;;; $Log: at386.el,v $ ; Revision 1.2 89/09/14 11:44:32 drich ; Modified to tread DEL/BS correctly, also modified to use C-? for help. ; ;;; Revision 1.1 89/09/14 11:06:16 drich ;;; Initial revision ;;; ;;; ;;; Tested on: GNU Emacs 18.54.1 of Mon Jul 24 1989 on dialogic (usg-unix-v) ;;; ;;; Note: The shift key will affect the value of a function key, but ;;; the control and alt keys do not. ;;; ;;; Most of the information needed to create this file was taken from ;;; documentation found in lisp/keypad.el ;;; (require 'keypad) (defvar AT386-map-1 nil "The map for the function keys on the at386") (defvar AT386-map-2 nil "The keypad map for the at386") (defvar last2 nil "Last key home/end, used in at386-home and at386-end") (defun enable-at386-keys () "Enable the use of the at386 function keys." (interactive) (global-set-key "\eO" AT386-map-1) (global-set-key "\e[" AT386-map-2)) (defun at386-home () "Move cursor to top of screen." (interactive) (setq last last-command) (if (equal last 'at386-home) (if (equal last2 t) (beginning-of-buffer) (progn (move-to-window-line 0) (setq last2 t))) (progn (beginning-of-line) (setq last2 nil)))) (defun at386-end () "Move cursor to bottom of screen." (interactive) (setq last last-command) (if (equal last 'at386-end) (if (equal last2 t) (end-of-buffer) (progn (move-to-window-line -1) (end-of-line) (setq last2 t))) (progn (end-of-line) (setq last2 nil)))) (defun line-to-top () (interactive) (recenter 0)) (defun line-to-bottom () (interactive) (recenter (- (window-height) 2))) ;;; Create a few new keypad defaults. Here's what I think I'm doing here: ;;; I look through "keypad.el" to find any unused entries in function-keymap ;;; and then create my own bindings for them here. Then I use the newly ;;; created ?x string in the setup-terminal-keymap. (define-key function-keymap "1" 'at386-end) (define-key function-keymap "3" 'scroll-down) (define-key function-keymap "5" 'recenter) (define-key function-keymap "7" 'at386-home) (define-key function-keymap "9" 'scroll-up) (define-key function-keymap "-" 'line-to-top) (define-key function-keymap "+" 'line-to-bottom) (if AT386-map-1 nil (setq AT386-map-1 (make-keymap)) ; O commands (setup-terminal-keymap AT386-map-1 '(("P" . ??) ; F1 (help-map) ))) (if AT386-map-2 nil (setq AT386-map-2 (make-keymap)) ; [ commands (setup-terminal-keymap AT386-map-2 '(("A" . ?u) ; Up Arrow (previous-line) ("B" . ?d) ; Down Arrow (next-line) ("C" . ?r) ; Right Arrow (forward-char) ("D" . ?l) ; Left Arrow (backward-char) ("H" . ?7) ; Home (move-to-window-line 0) ("Y" . ?1) ; End (move-to-window-line -1) ("G" . ?5) ; Clear (recenter) ("U" . ?9) ; Page up (scroll-down) ("V" . ?3) ; Page down (scroll-up) ("S" . ?-) ; - key (line-to-top) ("T" . ?+) ; + key (line-to-bottom) ("@" . ?I) ; Insert (insert-character) ))) (enable-at386-keys) ;; Change the keyboard translation to interpret: ;; C-h as DEL ;; C-? as C-h (actually C-? generates C-_) (setq keyboard-translate-table "\000\^a\^b\^c\^d\^e\^f\^g\^?\^i\^j\^k\^l\^m\^n\^o\^p\^q\^r\^s\^t\^u\^v\^w\^x\^y\^z\^[\034\^]\035\^h") -- Dan Rich | ARPA: drich%dialogic@uunet.uu.net UNIX Systems Administrator | UUCP: uunet!dialogic!drich Dialogic Corporation | - Time is an illusion. Lunchtime, doubly so. - (201) 334-8450 x213 | Douglas Adams