;;; unixpc.el: AT&T UNIXpc keyboard definitions for Gnu Emacs ;;; ;;; Brant Cheikes ;;; University of Pennsylvania ;;; Department of Computer and Information Science ;;; brant@manta.pha.pa.us, bpa!manta!brant ;;; Last Edit: 12 Feb 1990 ;;; ;;; Works on GNU Emacs 18.55.1 of Thu Aug 24 1989 on manta (usg-unix-v) ;;; ;;; 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. (require 'keypad) ;;; Note: for each mapping, I indicate the key on the UNIXpc followed ;;; by the Emacs command it is bound to (if any). (defvar UNIXPC-map-1 nil "N commands.") (defvar UNIXPC-map-2 nil "O commands.") (defvar UNIXPC-map-3 nil "[ commands.") (defvar UNIXPC-map-4 nil "P commands.") (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))) ;; N commands (setup-terminal-keymap UNIXPC-map-1 '(("a" . ?C) ; Rfrsh (recenter) ;;; ("B" . ??) ; Shift-Beg (beginning-of-line) ("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" . ?P) ; Prev (scroll-down) ;;; ("G" . ??) ; Shift-Prev (backward-sentence) ("h" . ?N) ; Next (scroll-up) ;;; ("H" . ??) ; Shift-Next (forward-sentence) ("i" . ?s) ; Mark (set-mark-command) ;;; ("I" . ??) ; Slect (other-window) ;;; ("j" . ??) ; Input Mode (toggle-read-only) ;;; ("J" . ??) ; Shift-Input Mode (add-global-abbrev) ;;; ("K" . ??) ; Shift-LeftArrow (backward-word) ;;; ("L" . ??) ; Shift-RightArrow (forward-word) ("M" . ?h) ; Shift-Home (move-to-window-line) ;;; ("N" . ??) ; Shift-End (end-of-line) )) (define-key global-map "\eN" UNIXPC-map-1))) (define-key UNIXPC-map-1 "B" 'beginning-of-line) (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" 'toggle-read-only) (define-key UNIXPC-map-1 "J" 'add-global-abbrev) (define-key UNIXPC-map-1 "K" 'backward-word) (define-key UNIXPC-map-1 "L" 'forward-word) (define-key UNIXPC-map-1 "N" 'end-of-line) (define-key UNIXPC-map-1 "h" 'scroll-up) (define-key UNIXPC-map-1 "g" 'scroll-down) (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))) ;; 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 (save-buffers-kill-emacs) ;;; ("K" . ??) ; Shift-Exit (suspend-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))) ;;; The "Begin" and "End" keys generate odd sequences, so they get ;;; treated specially. (define-key esc-map "9" 'beginning-of-buffer) ; Begin (define-key esc-map "0" 'end-of-buffer) ; 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" 'save-buffers-kill-emacs) (define-key UNIXPC-map-2 "K" 'suspend-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) (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))) ;; [ 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) )))) (define-key UNIXPC-map-3 "J" 'delete-other-windows) (if (not UNIXPC-map-4) (progn (setq UNIXPC-map-4 (lookup-key global-map "\eP")) (if (not (keymapp UNIXPC-map-4)) (setq UNIXPC-map-4 (make-sparse-keymap))) ;; P commands (setup-terminal-keymap UNIXPC-map-4 '( ;;; ("a" . ??) ; C-1, Ctrl-Prev ;;; ("b" . ??) ; C-2, Ctrl-UpArrow ;;; ("c" . ??) ; C-3, Ctrl-Next ;;; ("d" . ??) ; C-4, Ctrl-Beg ;;; ("e" . ??) ; C-5, Ctrl-Home ;;; ("f" . ??) ; C-6, Ctrl-End ;;; ("g" . ??) ; C-7, Ctrl-Print ;;; ("h" . ??) ; C-8, Ctrl-Rfrsh ;;; ("i" . ??) ; C-9, Ctrl-Page ;;; ("j" . ??) ; C-0, Ctrl-DownArrow ;;; ("k" . ??) ; C--, Ctrl-LeftArrow ("l" . ??))) ; C-=, Ctrl-RightArrow (define-key global-map "\eP" UNIXPC-map-4))) (define-key UNIXPC-map-4 "k" 'backward-word) (define-key UNIXPC-map-4 "l" 'forward-word) (define-key UNIXPC-map-4 "j" 'forward-paragraph) (define-key UNIXPC-map-4 "b" 'backward-paragraph) (defun enable-arrow-keys () "Enable the use of the Unix PC arrow keys. This breaks the [ command, so it is not done by default; you must explicitly call this function." (interactive) (global-set-key "\e[" UNIXPC-map-3))