Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!decwrl!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!uiucdcs!uxc.cso.uiuc.edu!urbsdc!aglew From: aglew@urbsdc.Urbana.Gould.COM Newsgroups: comp.emacs Subject: Re: function keys Message-ID: <57600015@urbsdc> Date: 12 May 88 16:55:00 GMT References: <436@marvin.cme-durer.ARPA> Lines: 183 Nf-ID: #R:marvin.cme-durer.ARPA:436:urbsdc:57600015:000:6500 Nf-From: urbsdc.Urbana.Gould.COM!aglew May 12 11:55:00 1988 Another spatially oriented keyboarder. Here is my customization file for a Datamedia XL 60, termcap D5 In it I first link the escape sequences generated by keys to symbolic names (and null functions) for the keys; and then link these "keyboard specific" names to a higher level of abstraction, the 3 by 4 keypad, which I have defined on a number of terminals. Elsewhere, I have a standard mapping of 3 by 4 keypads to commands. <<<<>>>>> ;; Macro to create a symbolic name for the sequence of characters produced ;; by a key, and to bind it to a usually undefined function of the same ;; name, so that pressing it gives you a message like tvi9220-key-HELP ;; not defined. (defmacro make-key (key str) (list 'progn (list 'setq key str) (list 'make-global-binding str (list 'quote key)))) <<<<<>>>>> ;;;; AG GNU Emacs customization for Datamedia keyboard terminal type ;; Is almost exactly the same as that for the tvi9220, with fewer keys (load "gnuterm/make-key") ; MISCELLANEOUS EDITING KEYS (make-key datamedia-key-TAB "\^i") ;standard ; BACK-TAB, INSERT-LINE, DELETE-LINE, CHAR-INSERT, EDIT, CLR, ; DELETE-CHAR, and ENTER are on numeric keypad. ;; PF keys, upper row of keypad. ;; Usually used in the key-3x4 arrangement of cursor keys (make-key datamedia-keypad-PF1 "\eOP") (make-key datamedia-keypad-PF2 "\eOQ") (make-key datamedia-keypad-PF3 "\eOR") (make-key datamedia-keypad-PF4 "\eOS") (make-key datamedia-keypad-PF5 "\eot") (make-key datamedia-keypad-PF6 "\eou") (make-key datamedia-keypad-PF7 "\eov") (make-key datamedia-keypad-PF8 "\eow") (make-key datamedia-keypad-PF9 "\eox") (make-key datamedia-keypad-PF10 "\eoy") (make-key datamedia-keypad-PF11 "\eoz") (make-key datamedia-keypad-PF12 "\eo\\") ;; CURSOR keys, not on the keypad, arranged UP DN L R ; Most often in application mode. (make-key datamedia-key-normal-cursor-up "\e[A") (make-key datamedia-key-normal-cursor-down "\e[B") (make-key datamedia-key-normal-cursor-right "\e[C") (make-key datamedia-key-normal-cursor-left "\e[D") ; Cursor keys can be shifted ; I am unlikely to want to use these for anything ; because they conflict with existing Emacs ESC commands (make-key datamedia-key-normal-shifted-cursor-up "\eM") (make-key datamedia-key-normal-shifted-cursor-down "\eD") (make-key datamedia-key-normal-shifted-cursor-right "\e[E") (make-key datamedia-key-normal-shifted-cursor-left "\e[F") ; Application mode cursor keys (make-key datamedia-key-application-cursor-up "\eOA") (make-key datamedia-key-application-cursor-down "\eOB") (make-key datamedia-key-application-cursor-right "\eOC") (make-key datamedia-key-application-cursor-left "\eOD") ;; KEYPAD keys - labeled as a numeric keypad, ;; but I wish to use their application codes, ;; even though ESC O ... is a loss. (make-key datamedia-keypad-0 "\eOp") (make-key datamedia-keypad-1 "\eOq") (make-key datamedia-keypad-2 "\eOr") (make-key datamedia-keypad-3 "\eOs") (make-key datamedia-keypad-4 "\eOt") (make-key datamedia-keypad-5 "\eOu") (make-key datamedia-keypad-6 "\eOv") (make-key datamedia-keypad-7 "\eOw") (make-key datamedia-keypad-8 "\eOx") (make-key datamedia-keypad-9 "\eOy") (make-key datamedia-keypad-- "\eOm") (make-key datamedia-keypad-COMMA "\eOl") (make-key datamedia-keypad-DOT "\eOn") (make-key datamedia-keypad-ENTER "\eOM") ;; FUNCTION keys ;; The datamedia supports both shifted and unshifted function keys F6-F20 ;; but, only the unshifted ones have codes assigned by default (make-key datamedia-key-F1 "\eO'") (make-key datamedia-key-F2 "\eOa") (make-key datamedia-key-F3 "\eOb") (make-key datamedia-key-F4 "\eOc") (make-key datamedia-key-F5 "\eOd") (make-key datamedia-key-F6 "\eOe") (make-key datamedia-key-F7 "\eOf") (make-key datamedia-key-F8 "\eOg") (make-key datamedia-key-F9 "\eOh") (make-key datamedia-key-F10 "\eOi") (make-key datamedia-key-F11 "\eOj") (make-key datamedia-key-F12 "\eOk") (make-key datamedia-key-F13 "\eOl") (make-key datamedia-key-F14 "\eOm") (make-key datamedia-key-F15 "\eOn") ;; SCREEN WIDTH ; I like toggling between 80 and 132 characters, depending on my eyestrain. (setq datamedia-command-80 "\e[?3l") (setq datamedia-command-132 "\e[?3h") (defun datamedia-set-screen-width (n) "change screen width (80/132)" (interactive "NScreen width (80/132): ") (cond ((= n 132) (set-screen-width 132) (send-string-to-terminal datamedia-command-132)) ((= n 80) (set-screen-width 80) (send-string-to-terminal datamedia-command-80)) (t (message "80/132 screen widths only knowm, not %d" n))) (redraw-display)) (defun toggle-screen-width () "toggle screen width between the various possibilities, typically 80/132" (interactive) (cond ((= (screen-width) 80) (datamedia-set-screen-width 132)) (t (datamedia-set-screen-width 80)))) (make-global-binding datamedia-keypad-ENTER 'toggle-screen-width) ;; INITIALIZE ;; Terminal dependent (defun datamedia-initialize () "initialize a DATAMEDIA for AG's GNU emacs" (interactive) (mapcar 'send-string-to-terminal (list "\e[?1l" ; Normal cursor keys ( ESC [ ... ) ; not application cursor keys "\e=" ; Application keypad mode ( ESC O ... ) ) ) ;(datamedia-load-function-keys) (datamedia-set-screen-width 80) ) ;; Actually invoke the initialization function (datamedia-initialize) ;; STANDARD KEY ABSTRACTIONS ; PF1 PF2 PF3 PF4 ; 7 8 9 - ; 4 5 6 ' ; 3 down by 4 across keypad ; superimposed on PF keys (defun datamedia-3x4-lower () (setq key-3x4-downLeft datamedia-keypad-4) (setq key-3x4-downleft datamedia-keypad-5) (setq key-3x4-down datamedia-keypad-6) (setq key-3x4-downRight datamedia-keypad-COMMA) (setq key-3x4-Left datamedia-keypad-7) (setq key-3x4-left datamedia-keypad-8) (setq key-3x4-right datamedia-keypad-9) (setq key-3x4-Right datamedia-keypad--) (setq key-3x4-upLeft datamedia-keypad-PF1) (setq key-3x4-upleft datamedia-keypad-PF2) (setq key-3x4-up datamedia-keypad-PF3) (setq key-3x4-upRight datamedia-keypad-PF4)) (datamedia-3x4-lower) (defun datamedia-arrow-keys () (setq key-arrow-down datamedia-key-application-cursor-down) (setq key-arrow-up datamedia-key-application-cursor-up) (setq key-arrow-left datamedia-key-application-cursor-left) (setq key-arrow-right datamedia-key-application-cursor-right)) (datamedia-arrow-keys)