sac@conrad.UUCP (Steven A. Conrad) (09/10/88)
Enclosed is a copy of a terminal-specific Emacs initialization file for the UNIX-pc. The UNIX-pc has a number of function keys (about 75 or so key sequences!) which can be bound to perform most of the common Emacs functions with single key (or shifted key) sequences. ----------- CUT HERE ----------- ;;; unixpc.el: AT&T Unix PC keyboard definitions ;;; Brant Cheikes ;;; University of Pennsylvania ;;; Department of Computer and Information Science ;;; Internet: brant@manta.pha.pa.us, UUCP: {bpa,drexel}!manta!brant ;;; 29 August 1987 ;;; ;;; Modified by Steven A. Conrad (sac@conrad.UUCP) ;;; 24 April 1988 ;;; ;;; Works on GNU Emacs 18.50 on conrad ;;; ;;; The AT&T Unix PC (aka PC7300, 3B1) has a bizarre keyboard with ;;; lots of interestingly labeled function keys. This file tries to ;;; assign useful actions to the function keys. Note that the Shift ;;; and Ctrl keys have the same effect on function keys, so Shift-F1 ;;; is the same as Ctrl-F1. (require 'keypad) ;;; There seem to be three prefixes for AT&T UnixPC function keys: ;;; "<esc>O", "<esc>N", and "<esc>[". There seem to be a couple ;;; keys that just generate "<esc><digit>". ;;; ;;; Note: for each mapping, I indicate the key on the Unix PC followed ;;; by the Emacs command it is bound to (if any). (defvar UNIXPC-map-1 nil "The bulk of the function keys on the AT&T Unix PC.") (defvar UNIXPC-map-2 nil "A few other random function keys on the AT&T Unix PC.") (defvar UNIXPC-map-3 nil "Some really random function keys on the AT&T Unix PC.") ;;; Use built-in mappings first (as defined in keypad.el) ;;; Lines commented out are mapped later. (if (not UNIXPC-map-3) (progn (setq UNIXPC-map-3 (lookup-key global-map "\e[")) (if (not (keymapp UNIXPC-map-3)) (setq UNIXPC-map-3 (make-sparse-keymap))) ;; <ESC>[ commands (setup-terminal-keymap UNIXPC-map-3 '(("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" . ?h) ; Home (move-to-window-line) ;;; ("J" . ??) ; Clear (delete-other-windows) ("S" . ?9) ; Shift-DownArrow (forward-paragraph) ("T" . ?7) ; Shift-UpArrow (backward-paragraph) ("U" . ?N) ; Page (scroll-up) ("V" . ?P) ; Shift-Page (scroll-down) )))) ;;; Personalized mappings. (define-key UNIXPC-map-3 "J" 'delete-other-windows) (defun enable-arrow-keys () "Enable the use of the Unix PC arrow keys. This breaks the <esc>[ command, so it is not done by default; you must explicitly call this function." (interactive) (global-set-key "\e[" UNIXPC-map-3)) (if (not UNIXPC-map-1) (progn (setq UNIXPC-map-1 (lookup-key global-map "\eN")) (if (not (keymapp UNIXPC-map-1)) (setq UNIXPC-map-1 (make-sparse-keymap))) ;; <ESC>N commands (setup-terminal-keymap UNIXPC-map-1 '(("a" . ?C) ; Rfrsh (recenter) ;;; ("B" . ??) ; Shift-Beg (beginning-of-buffer) ("c" . ?0) ; Move (yank) ;;; ("C" . ??) ; Shift-Move (insert-register) ;;; ("d" . ??) ; Copy (copy-region-as-kill) ;;; ("D" . ??) ; Shift-Copy (copy-to-register) ("e" . ?k) ; Dlete (kill-region) ;;; ("E" . ??) ; Shift-Dlete (append-to-buffer) ("f" . ?.) ; Dlete Char (delete-char) ;;; ("F" . ??) ; Shift-Dlete Char (kill-word) ("g" . ?1) ; Prev (backward-word) ;;; ("G" . ??) ; Shift-Prev (backward-sentence) ("h" . ?3) ; Next (forward-word) ;;; ("H" . ??) ; Shift-Next (forward-sentence) ("i" . ?s) ; Mark (set-mark-command) ;;; ("I" . ??) ; Slect (other-window) ;;; ("j" . ??) ; Input Mode (universal-argument) ;;; ("J" . ??) ; Shift-Input Mode (add-global-abbrev) ;;; ("K" . ??) ; Shift-LeftArrow (backward-sexp) ;;; ("L" . ??) ; Shift-RightArrow (forward-sexp) ("M" . ?h) ; Shift-Home (move-to-window-line) ;;; ("N" . ??) ; Shift-End (end-of-buffer) )) (define-key global-map "\eN" UNIXPC-map-1))) ;;; More personal mappings. (define-key UNIXPC-map-1 "B" 'beginning-of-buffer) (define-key UNIXPC-map-1 "C" 'insert-register) (define-key UNIXPC-map-1 "d" 'copy-region-as-kill) (define-key UNIXPC-map-1 "D" 'copy-to-register) (define-key UNIXPC-map-1 "E" 'append-to-buffer) (define-key UNIXPC-map-1 "F" 'kill-word) (define-key UNIXPC-map-1 "G" 'backward-sentence) (define-key UNIXPC-map-1 "H" 'forward-sentence) (define-key UNIXPC-map-1 "I" 'other-window) (define-key UNIXPC-map-1 "j" 'universal-argument) (define-key UNIXPC-map-1 "J" 'add-global-abbrev) (define-key UNIXPC-map-1 "K" 'backward-sexp) (define-key UNIXPC-map-1 "L" 'forward-sexp) (define-key UNIXPC-map-1 "N" 'end-of-buffer) (if (not UNIXPC-map-2) (progn (setq UNIXPC-map-2 (lookup-key global-map "\eO")) (if (not (keymapp UNIXPC-map-2)) (setq UNIXPC-map-2 (make-sparse-keymap))) ;; <ESC>O commands (setup-terminal-keymap UNIXPC-map-2 '( ;;; ("a" . ??) ; Clear Line (kill-line) ;;; ("A" . ??) ; Shift-Clear Line (kill-sentence) ;;; ("b" . ??) ; Ref (spell-word) ;;; ("B" . ??) ; Rstrt (spell-region) ;;; ("c" . ??) ; F1 (start-kbd-macro) ;;; ("d" . ??) ; F2 (end-kbd-macro) ;;; ("e" . ??) ; F3 (call-last-kbd-macro) ;;; ("f" . ??) ; F4 (top-level) ;;; ("g" . ??) ; F5 (kill-compilation) ;;; ("h" . ??) ; F6 (add-mode-abbrev) ;;; ("i" . ??) ; F7 (inverse-add-mode-abbrev) ;;; ("j" . ??) ; F8 (abbrev-mode) ;;; ("k" . ??) ; Exit (suspend-emacs) ;;; ("K" . ??) ; Shift-Exit (save-buffers-kill-emacs) ("m" . ??) ; Help (help-command) ;;; ("M" . ??) ; Shift-Help (what-line) ;;; ("n" . ??) ; Creat (split-window-vertically) ;;; ("N" . ??) ; Shift-Creat (split-window-horizontally) ;;; ("o" . ??) ; Save (save-buffer) ;;; ("O" . ??) ; Shift-Save (write-file) ;;; ("r" . ??) ; Opts (buffer-menu) ;;; ("R" . ??) ; Shift-Opts (dired) ;;; ("s" . ??) ; Undo (advertised-undo) ;;; ("S" . ??) ; Shift-Undo (advertised-undo) ;;; ("t" . ??) ; Redo (fill-paragraph) ;;; ("T" . ??) ; Shift-Redo (fill-region) ;;; ("u" . ??) ; Cmd (execute-extended-command) ;;; ("U" . ??) ; Shift-Cmd (compile) ;;; ("v" . ??) ; Open (find-file) ;;; ("V" . ??) ; Close (kill-buffer) ;;; ("w" . ??) ; Cancl (keyboard-quit) ;;; ("W" . ??) ; Shift-Cancl (delete-window) ;;; ("x" . ??) ; Find (isearch-forward) ("X" . ?f) ; Shift-Find (isearch-forward-regexp) ; ("y" . ??) ; Rplac (query-replace-regexp) ; ("Y" . ??) ; Shift-Rplac (regexp-replace) ; ("z" . ??) ; Print (print-buffer) )) (define-key global-map "\eO" UNIXPC-map-2))) ;;; Last batch of personalized mappings. ;;; The "Begin" and "End" keys generate odd sequences, so they get ;;; treated specially. (define-key esc-map "9" 'beginning-of-line) ; Begin (define-key esc-map "0" 'end-of-line) ; End (define-key UNIXPC-map-2 "a" 'kill-line) (define-key UNIXPC-map-2 "A" 'kill-sentence) (define-key UNIXPC-map-2 "b" 'spell-word) (define-key UNIXPC-map-2 "B" 'spell-region) (define-key UNIXPC-map-2 "c" 'start-kbd-macro) (define-key UNIXPC-map-2 "d" 'end-kbd-macro) (define-key UNIXPC-map-2 "e" 'call-last-kbd-macro) (define-key UNIXPC-map-2 "f" 'top-level) (define-key UNIXPC-map-2 "g" 'kill-compilation) (define-key UNIXPC-map-2 "h" 'add-mode-abbrev) (define-key UNIXPC-map-2 "i" 'inverse-add-mode-abbrev) (define-key UNIXPC-map-2 "j" 'abbrev-mode) (define-key UNIXPC-map-2 "k" 'suspend-emacs) (define-key UNIXPC-map-2 "K" 'save-buffers-kill-emacs) (define-key UNIXPC-map-2 "M" 'what-line) (define-key UNIXPC-map-2 "n" 'split-window-vertically) (define-key UNIXPC-map-2 "N" 'split-window-horizontally) (define-key UNIXPC-map-2 "o" 'save-buffer) (define-key UNIXPC-map-2 "O" 'write-file) (define-key UNIXPC-map-2 "r" 'buffer-menu) (define-key UNIXPC-map-2 "R" 'dired) (define-key UNIXPC-map-2 "s" 'advertised-undo) (define-key UNIXPC-map-2 "S" 'advertised-undo) (define-key UNIXPC-map-2 "t" 'fill-paragraph) (define-key UNIXPC-map-2 "T" 'fill-region) (define-key UNIXPC-map-2 "u" 'execute-extended-command) (define-key UNIXPC-map-2 "U" 'compile) (define-key UNIXPC-map-2 "v" 'find-file) (define-key UNIXPC-map-2 "V" 'kill-buffer) (define-key UNIXPC-map-2 "w" 'keyboard-quit) (define-key UNIXPC-map-2 "W" 'delete-window) (define-key UNIXPC-map-2 "x" 'isearch-forward) (define-key UNIXPC-map-2 "y" 'query-replace-regexp) (define-key UNIXPC-map-2 "Y" 'replace-regexp) (define-key UNIXPC-map-2 "z" 'print-buffer) --------- END CUT -------------- -- Steven A. Conrad, Department of Medicine (Critical Care) Louisiana State University Medical Center, Shreveport, LA UUCP: sac@conrad.UUCP, Internet: conrad@manta.pha.pa.us