Mercurial > hg > xemacs-beta
comparison lisp/term/tvi970.el @ 0:376386a54a3c r19-14
Import from CVS: tag r19-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:45:50 +0200 |
parents | |
children | 461c7ba8286a |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:376386a54a3c |
---|---|
1 ;;; tvi970.el --- terminal support for the Televideo 970 | |
2 | |
3 ;; Author: Jim Blandy <jimb@occs.cs.oberlin.edu>, January 1992 | |
4 ;; Keywords: terminals | |
5 | |
6 ;; Copyright (C) 1992 Free Software Foundation, Inc. | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
24 ;;; Commentary: | |
25 | |
26 ;;; Uses the Emacs 19 terminal initialization features --- won't work with 18. | |
27 | |
28 ;;; Code: | |
29 | |
30 (or (lookup-key function-key-map "\e[") | |
31 (define-key function-key-map "\e[" (make-keymap))) | |
32 ;; (or (lookup-key function-key-map "\eO") | |
33 ;; (define-key function-key-map "\eO" (make-keymap))) | |
34 | |
35 ;; Miscellaneous keys | |
36 (mapcar (function (lambda (key-binding) | |
37 (define-key function-key-map | |
38 (car key-binding) (nth 1 key-binding)))) | |
39 '( | |
40 ;; These are set up by termcap or terminfo | |
41 ;; ("\eOP" [kp_f1]) | |
42 ;; ("\eOQ" [kp_f2]) | |
43 ;; ("\eOR" [kp_f3]) | |
44 ;; ("\eOS" [kp_f4]) | |
45 | |
46 ;; These might br set by terminfo | |
47 ("\e[H" [home]) | |
48 ("\e[Z" [backtab]) | |
49 ("\e[i" [print]) | |
50 ("\e[@" [insert]) | |
51 ("\e[L" [insertline]) | |
52 ("\e[M" [deleteline]) | |
53 ("\e[U" [next]) ;; actually the `page' key | |
54 | |
55 ;; These won't be set up by either | |
56 ("\eOm" [kp_subtract]) | |
57 ("\eOl" [kp_separator]) | |
58 ("\eOn" [kp_decimal]) | |
59 ("\eOM" [kp_enter]) | |
60 | |
61 ;; These won't be set up by either either | |
62 ("\e[K" [key_eol]) ;; Not an X keysym | |
63 ("\e[J" [key_eos]) ;; Not an X keysym | |
64 ("\e[2J" [key_clear]) ;; Not an X keysym | |
65 ("\e[P" [key_dc]) ;; Not an X keysym | |
66 ("\e[g" [(shift tab)]) ;; Not an X keysym | |
67 ("\e[2N" [clearentry]) ;; Not an X keysym | |
68 ("\e[2K" [(shift clearentry)]) ;; Not an X keysym | |
69 ("\e[E" [?\C-j]) ;; Not an X keysym | |
70 ("\e[g" [(shift backtab)]) ;; Not an X keysym | |
71 ("\e[?1i" [key_sprint]) ;; Not an X keysym | |
72 ("\e[4h" [key_sic]) ;; Not an X keysym | |
73 ("\e[4l" [(shift delete)]) ;; Not an X keysym | |
74 ("\e[Q" [(shift insertline)]) ;; Not an X keysym | |
75 ("\e[1Q" [key_sdl]) ;; Not an X keysym | |
76 ("\e[19l" [key_seol]) ;; Not an X keysym | |
77 ("\e[19h" [(shift erasepage)]) ;; Not an X keysym | |
78 ("\e[V" [(shift page)]) ;; Not an X keysym | |
79 ("\eS" [send]) ;; Not an X keysym | |
80 ("\e5" [(shift send)]) ;; Not an X keysym | |
81 )) | |
82 | |
83 ;; The numeric keypad keys. | |
84 (let ((i 0)) | |
85 (while (< i 10) | |
86 (define-key function-key-map | |
87 (format "\eO%c" (+ i ?p)) | |
88 (vector (intern (format "kp_%d" i)))) | |
89 (setq i (1+ i)))) | |
90 ;; The numbered function keys. | |
91 (let ((i 0)) | |
92 (while (< i 16) | |
93 (define-key function-key-map | |
94 (format "\e?%c" (+ i ?a)) | |
95 (vector (intern (format "f%d" (1+ i))))) | |
96 (define-key function-key-map | |
97 (format "\e?%c" (+ i ?A)) | |
98 (vector (list 'shift (intern (format "f%d" (1+ i)))))) | |
99 (setq i (1+ i)))) | |
100 | |
101 | |
102 ;;; Should keypad numbers send ordinary digits or distinct escape sequences? | |
103 (defvar tvi970-keypad-numeric nil | |
104 "The terminal should be in numeric keypad mode iff this variable is non-nil. | |
105 Do not set this variable! Call the function ``tvi970-set-keypad-mode''.") | |
106 | |
107 (defun tvi970-set-keypad-mode (&optional arg) | |
108 "Set the current mode of the TVI 970 numeric keypad. | |
109 In ``numeric keypad mode'', the number keys on the keypad act as | |
110 ordinary digits. In ``alternate keypad mode'', the keys send distinct | |
111 escape sequences, meaning that they can have their own bindings, | |
112 independent of the normal number keys. | |
113 With no argument, toggle between the two possible modes. | |
114 With a positive argument, select alternate keypad mode. | |
115 With a negative argument, select numeric keypad mode." | |
116 (interactive "P") | |
117 (setq tvi970-keypad-numeric | |
118 (if (null arg) | |
119 (not tvi970-keypad-numeric) | |
120 (> (prefix-numeric-value arg) 0))) | |
121 (send-string-to-terminal (if tvi970-keypad-numeric "\e=" "\e>"))) | |
122 | |
123 (tvi970-set-keypad-mode 1) | |
124 | |
125 ;;; tv970 ends here |