Annotation of 43BSD/contrib/emacs/lisp/term/vt200.el, revision 1.1.1.1

1.1       root        1: ;; vt200 series terminal stuff.
                      2: ;; April 1985, Joe Kelsey
                      3: 
                      4: (defvar CSI-map nil
                      5:   "The CSI-map maps the CSI function keys on the VT201 keyboard.
                      6: The CSI keys are the dark function keys, and are only active in
                      7: VT200-mode, except for the arrow keys.  The functions provided are:
                      8: 
                      9: Arrows: The obvious definitions: backward-char, next-line, forward-char,
                     10:                                              previous-line.
                     11: 
                     12: Editing Keys:
                     13:   Find                  re-search-forward
                     14:   Insert Here           open-line
                     15:   Remove                kill-region
                     16:   Select                set-mark-command
                     17:   Prev Screen           scroll-up
                     18:   Next Screen           scroll-down
                     19: 
                     20: Top row keys:
                     21:   F11                   ESC-prefix
                     22:   Help                  help-command
                     23:   Do                    eval-expression
                     24: 
                     25: You can bind other function keys by doing:
                     26:   (define-key CSI-map \"<key>\" '<function>)
                     27: where <key> is the function key with the CSI (<ESC>[) stripped off
                     28: and <function> is the name of the function to map the key to.")
                     29: 
                     30: (defvar SS3-map nil
                     31:   "SS3-map maps the SS3 function keys on the VT201 keyboard.
                     32: The SS3 keys are the numeric keypad keys in keypad application mode
                     33: (DECKPAM).  SS3 is the ASCII-8bit character for the 7-bit escape
                     34: sequence <ESC>O.  The functions provided are:
                     35: 
                     36:   -----------------------------------------------------------------
                     37:   |PF1            |PF2            |PF3            |PF4            |
                     38:   |beginning-of-  |               |               |               |
                     39:   |line           |end-of-line    |isearch-forward|kill-line      |
                     40:   |---------------+---------------+---------------+---------------|
                     41:   |7              |8              |9              |-              |
                     42:   |forward-       |backward-      |               |               |
                     43:   |paragraph      |paragraph      |kill-region    |kill-word      |
                     44:   |---------------+---------------+---------------+---------------|
                     45:   |4              |5              |6              |,              |
                     46:   |               |beginning-of-  |               |               |
                     47:   |end-of-buffer  |buffer         |yank           |delete-char    |
                     48:   |---------------+---------------+---------------+---------------|
                     49:   |1              |2              |3              |Enter          |
                     50:   |               |               |               |               |
                     51:   |forward-word   |backward-word  |quoted-insert  |               |
                     52:   |---------------+---------------+---------------|               | 
                     53:   |0                              |.              |               |
                     54:   |                               |beginning-of-  |               |
                     55:   |beginning-of-next-line         |previous-line  |open-line      |
                     56:   -----------------------------------------------------------------")
                     57: 
                     58: (if (not CSI-map)
                     59:     (progn
                     60:      (setq CSI-map (make-keymap))  ;; <ESC>[ commands
                     61: 
                     62:      (define-key CSI-map "A" 'previous-line)               ;; up arrow
                     63:      (define-key CSI-map "B" 'next-line)                   ;; down-arrow
                     64:      (define-key CSI-map "C" 'forward-char)                ;; right-arrow
                     65:      (define-key CSI-map "D" 'backward-char)               ;; left-arrow
                     66: 
                     67:      (define-key CSI-map "1~" 're-search-forward)          ;; Find
                     68:      (define-key CSI-map "2~" 'open-line)                  ;; Insert Here
                     69:      (define-key CSI-map "3~" 'kill-region)                ;; Re-move
                     70: 
                     71:      (define-key CSI-map "4~" 'set-mark-command)           ;; Select
                     72:      (define-key CSI-map "5~" 'scroll-down)                ;; Prev Screen
                     73:      (define-key CSI-map "6~" 'scroll-up)                  ;; Next Screen
                     74: 
                     75:      (define-key CSI-map "23~" 'ESC-prefix)                ;; F11 (ESC)
                     76: 
                     77:      (define-key CSI-map "28~" 'help-command)              ;; Help
                     78:      (define-key CSI-map "29~" 'eval-expression)           ;; Do
                     79: 
                     80:      (setq SS3-map (make-keymap))  ;; <ESC>O commands
                     81: 
                     82:      (define-key SS3-map "A" 'previous-line)               ;; up arrow
                     83:      (define-key SS3-map "B" 'next-line)                   ;; down-arrow
                     84:      (define-key SS3-map "C" 'forward-char)                ;; right-arrow
                     85:      (define-key SS3-map "D" 'backward-char)               ;; left-arrow
                     86: 
                     87:      (define-key SS3-map "M" 'open-line)                   ;; Enter
                     88: 
                     89:      (define-key SS3-map "P" 'beginning-of-line)           ;; PF1
                     90:      (define-key SS3-map "Q" 'end-of-line)                 ;; PF2
                     91:      (define-key SS3-map "R" 'isearch-forward)             ;; PF3
                     92:      (define-key SS3-map "S" 'kill-line)                   ;; PF4
                     93: 
                     94:      (define-key SS3-map "l" 'delete-char)                 ;; ,
                     95:      (define-key SS3-map "m" 'kill-word)                   ;; -
                     96: 
                     97:      (define-key SS3-map "n" 'beginning-of-previous-line)  ;; .
                     98:      (define-key SS3-map "p" 'beginning-of-next-line)      ;; 0
                     99: 
                    100:      (define-key SS3-map "q" 'forward-word)                ;; 1
                    101:      (define-key SS3-map "r" 'backward-word)               ;; 2
                    102:      (define-key SS3-map "s" 'quoted-insert)               ;; 3
                    103: 
                    104:      (define-key SS3-map "t" 'end-of-buffer)               ;; 4
                    105:      (define-key SS3-map "u" 'beginning-of-buffer)         ;; 5
                    106:      (define-key SS3-map "v" 'yank)                        ;; 6
                    107: 
                    108:      (define-key SS3-map "w" 'forward-paragraph)           ;; 7
                    109:      (define-key SS3-map "x" 'backward-paragraph)          ;; 8
                    110:      (define-key SS3-map "y" 'kill-region)                 ;; 9
                    111: 
                    112:      (define-key global-map "\eO" SS3-map)
                    113:      ))
                    114: 
                    115: (defun vt200-enable-arrows ()
                    116:   "Redefine Emacs so that VT200 arrow keys and function keys work.
                    117: This is not done automatically because it inescapably causes the
                    118: standard Emacs command ESC [ to stop working normally."
                    119:   (interactive)
                    120:   (define-key global-map "\e[" CSI-map))
                    121: 
                    122: 
                    123: (defun beginning-of-next-line ()
                    124:   "Move to the beginning of the next line."
                    125:   (interactive)
                    126:   (forward-line 1))
                    127: 
                    128: (defun beginning-of-previous-line ()
                    129:   "Move to the beginning of the previous line."
                    130:   (interactive)
                    131:   (forward-line -1))

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.