]> code.delx.au - gnu-emacs/blob - lisp/term/iris-ansi.el
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
[gnu-emacs] / lisp / term / iris-ansi.el
1 ;;; iris-ansi.el --- configure Emacs for SGI xwsh and winterm apps -*- no-byte-compile: t -*-
2
3 ;; Copyright (C) 1997, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4
5 ;; Author: Dan Nicolaescu <dann@ics.uci.edu>
6
7 ;; This file is part of GNU Emacs.
8
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; any later version.
13
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
23
24 ;;; Commentary:
25
26 ;;; Code:
27
28 (defvar iris-function-map nil
29 "Function key definitions for SGI xwsh and winterm apps.")
30
31 ;; Make reloads faster.
32 (unless iris-function-map
33 (setq iris-function-map (make-sparse-keymap))
34
35 (define-key iris-function-map "\e[120q" [S-escape])
36 (define-key iris-function-map "\e[121q" [C-escape])
37
38 (define-key iris-function-map "\e[001q" [f1])
39 (define-key iris-function-map "\e[013q" [S-f1])
40 (define-key iris-function-map "\e[025q" [C-f1])
41
42
43 (define-key iris-function-map "\e[002q" [f2])
44 (define-key iris-function-map "\e[014q" [S-f2])
45 (define-key iris-function-map "\e[026q" [C-f2])
46 (define-key iris-function-map "\e[038q" [M-f2])
47
48 (define-key iris-function-map "\e[003q" [f3])
49 (define-key iris-function-map "\e[015q" [S-f3])
50 (define-key iris-function-map "\e[027q" [C-f3])
51
52
53 (define-key iris-function-map "\e[004q" [f4])
54 (define-key iris-function-map "\e[016q" [S-f4])
55 (define-key iris-function-map "\e[028q" [C-f4])
56
57
58 (define-key iris-function-map "\e[005q" [f5])
59 (define-key iris-function-map "\e[017q" [S-f5])
60 (define-key iris-function-map "\e[029q" [C-f5])
61
62
63 (define-key iris-function-map "\e[006q" [f6])
64 (define-key iris-function-map "\e[018q" [S-f6])
65 (define-key iris-function-map "\e[030q" [C-f6])
66
67
68 (define-key iris-function-map "\e[007q" [f7])
69 (define-key iris-function-map "\e[019q" [S-f7])
70 (define-key iris-function-map "\e[031q" [C-f7])
71
72
73 (define-key iris-function-map "\e[008q" [f8])
74 (define-key iris-function-map "\e[020q" [S-f8])
75 (define-key iris-function-map "\e[032q" [C-f8])
76
77
78 (define-key iris-function-map "\e[009q" [f9])
79 (define-key iris-function-map "\e[021q" [S-f9])
80 (define-key iris-function-map "\e[033q" [C-f9])
81
82
83 (define-key iris-function-map "\e[010q" [f10])
84 (define-key iris-function-map "\e[022q" [S-f10])
85 (define-key iris-function-map "\e[034q" [C-f10])
86
87
88 (define-key iris-function-map "\e[011q" [f11])
89 (define-key iris-function-map "\e[023q" [S-f11])
90 (define-key iris-function-map "\e[035q" [C-f11])
91 (define-key iris-function-map "\e[047q" [M-f11])
92
93 (define-key iris-function-map "\e[012q" [f12])
94 (define-key iris-function-map "\e[024q" [S-f12])
95 (define-key iris-function-map "\e[036q" [C-f12])
96 (define-key iris-function-map "\e[048q" [M-f12])
97
98
99 (define-key iris-function-map "\e[057q" [C-`])
100 (define-key iris-function-map "\e[115q" [M-`])
101
102 (define-key iris-function-map "\e[049q" [?\C-1])
103 (define-key iris-function-map "\e[058q" [?\M-1])
104
105
106 (define-key iris-function-map "\e[059q" [?\M-2])
107
108 (define-key iris-function-map "\e[050q" [?\C-3])
109 (define-key iris-function-map "\e[060q" [?\M-3])
110
111 (define-key iris-function-map "\e[051q" [?\C-4])
112 (define-key iris-function-map "\e[061q" [?\M-4])
113
114 (define-key iris-function-map "\e[052q" [?\C-5])
115 (define-key iris-function-map "\e[062q" [?\M-5])
116
117
118 (define-key iris-function-map "\e[063q" [?\M-6])
119
120 (define-key iris-function-map "\e[053q" [?\C-7])
121 (define-key iris-function-map "\e[064q" [?\M-7])
122
123 (define-key iris-function-map "\e[054q" [?\C-8])
124 (define-key iris-function-map "\e[065q" [?\M-8])
125
126 (define-key iris-function-map "\e[055q" [?\C-9])
127 (define-key iris-function-map "\e[066q" [?\M-9])
128
129 (define-key iris-function-map "\e[056q" [?\C-0])
130 (define-key iris-function-map "\e[067q" [?\M-0])
131
132 (define-key iris-function-map "\e[068q" [?\M--])
133
134 (define-key iris-function-map "\e[069q" [?\C-=])
135 (define-key iris-function-map "\e[070q" [?\M-=])
136
137 ;; I don't know what to do with those.
138 ;;(define-key iris-function-map "^H" [<del>])
139 ;;(define-key iris-function-map "^H" [S-<del>])
140 ;;(define-key iris-function-map "\177" [C-<del>])
141 ;;(define-key iris-function-map "\e[071q" [M-<del>])
142
143 (define-key iris-function-map "\e[Z" [?\S-\t])
144 (define-key iris-function-map "\e[072q" [?\C-\t])
145 ;; This only works if you remove the M-TAB keybing from the system.4Dwmrc
146 ;; our your ~/.4Dwmrc, if you use the 4Dwm window manager.
147 (define-key iris-function-map "\e[073q" [?\M-\t])
148
149 (define-key iris-function-map "\e[074q" [?\M-q])
150
151 (define-key iris-function-map "\e[075q" [?\M-w])
152
153 (define-key iris-function-map "\e[076q" [?\M-e])
154
155 (define-key iris-function-map "\e[077q" [?\M-r])
156
157 (define-key iris-function-map "\e[078q" [?\M-t])
158
159 (define-key iris-function-map "\e[079q" [?\M-y])
160
161 (define-key iris-function-map "\e[080q" [?\M-u])
162
163 (define-key iris-function-map "\e[081q" [?\M-i])
164
165 (define-key iris-function-map "\e[082q" [?\M-o])
166
167 (define-key iris-function-map "\e[083q" [?\M-p])
168
169 (define-key iris-function-map "\e[084q" [?\M-\[])
170
171 (define-key iris-function-map "\e[085q" [?\M-\]])
172
173 (define-key iris-function-map "\e[086q" [?\M-\\])
174
175 (define-key iris-function-map "\e[087q" [?\M-a])
176
177 (define-key iris-function-map "\e[088q" [?\M-s])
178
179 (define-key iris-function-map "\e[089q" [?\M-d])
180
181 (define-key iris-function-map "\e[090q" [?\M-f])
182
183 (define-key iris-function-map "\e[091q" [?\M-g])
184
185 (define-key iris-function-map "\e[092q" [?\M-h])
186
187 (define-key iris-function-map "\e[093q" [?\M-j])
188
189 (define-key iris-function-map "\e[094q" [?\M-k])
190
191 (define-key iris-function-map "\e[095q" [?\M-l])
192
193 (define-key iris-function-map "\e[096q" [?\C-\;])
194 (define-key iris-function-map "\e[097q" [?\M-:]) ;; we are cheating
195 ;; here, this is realy
196 ;; M-;, but M-:
197 ;; generates the same
198 ;; string and is more
199 ;; usefull.
200
201 (define-key iris-function-map "\e[098q" [?\C-'])
202 (define-key iris-function-map "\e[099q" [?\M-'])
203
204 (define-key iris-function-map "\e[100q" [?\M-\n])
205
206 (define-key iris-function-map "\e[101q" [?\M-z])
207
208 (define-key iris-function-map "\e[102q" [?\M-x])
209
210 (define-key iris-function-map "\e[103q" [?\M-c])
211
212 (define-key iris-function-map "\e[104q" [?\M-v])
213
214 (define-key iris-function-map "\e[105q" [?\M-b])
215
216 (define-key iris-function-map "\e[106q" [M-n])
217
218 (define-key iris-function-map "\e[107q" [M-m])
219
220 (define-key iris-function-map "\e[108q" [?\C-,])
221 (define-key iris-function-map "\e[109q" [?\M-,])
222
223 (define-key iris-function-map "\e[110q" [?\C-.])
224 (define-key iris-function-map "\e[111q" [?\M-.])
225
226 (define-key iris-function-map "\e[112q" [?\C-/])
227 (define-key iris-function-map "\e[113q" [?\M-/])
228
229 (define-key iris-function-map "\e[139q" [insert])
230 (define-key iris-function-map "\e[139q" [S-insert])
231 (define-key iris-function-map "\e[140q" [C-insert])
232 (define-key iris-function-map "\e[141q" [M-insert])
233
234 (define-key iris-function-map "\e[H" [home])
235 (define-key iris-function-map "\e[143q" [S-home])
236 (define-key iris-function-map "\e[144q" [C-home])
237
238
239 (define-key iris-function-map "\e[150q" [prior])
240 (define-key iris-function-map "\e[151q" [S-prior]) ;; those don't seem
241 ;; to generate
242 ;; anything
243 (define-key iris-function-map "\e[152q" [C-prior])
244
245
246 ;; (define-key iris-function-map "^?" [delete]) ?? something else seems to take care of this.
247 (define-key iris-function-map "\e[P" [S-delete])
248 (define-key iris-function-map "\e[142q" [C-delete])
249 (define-key iris-function-map "\e[M" [M-delete])
250
251 (define-key iris-function-map "\e[146q" [end])
252 (define-key iris-function-map "\e[147q" [S-end]) ;; those don't seem to
253 ;; generate anything
254 (define-key iris-function-map "\e[148q" [C-end])
255
256 (define-key iris-function-map "\e[154q" [next])
257 (define-key iris-function-map "\e[155q" [S-next])
258 (define-key iris-function-map "\e[156q" [C-next])
259
260
261 (define-key iris-function-map "\e[161q" [S-up])
262 (define-key iris-function-map "\e[162q" [C-up])
263 (define-key iris-function-map "\e[163q" [M-up])
264
265 (define-key iris-function-map "\e[158q" [S-left])
266 (define-key iris-function-map "\e[159q" [C-left])
267 (define-key iris-function-map "\e[160q" [M-left])
268
269 (define-key iris-function-map "\e[164q" [S-down])
270 (define-key iris-function-map "\e[165q" [C-down])
271 (define-key iris-function-map "\e[166q" [M-down])
272
273 (define-key iris-function-map "\e[167q" [S-right])
274 (define-key iris-function-map "\e[168q" [C-right])
275 (define-key iris-function-map "\e[169q" [M-right])
276
277 ;; Keypad functions, most of those are untested.
278 (define-key iris-function-map "\e[179q" [?\C-/])
279 (define-key iris-function-map "\e[180q" [?\M-/])
280
281 (define-key iris-function-map "\e[187q" [?\C-*])
282 (define-key iris-function-map "\e[188q" [?\M-*])
283
284 (define-key iris-function-map "\e[198q" [?\C--])
285 (define-key iris-function-map "\e[199q" [?\M--])
286
287 ;; Something else takes care of home, up, prior, down, left, right, next
288 ;(define-key iris-function-map "\e[H" [home])
289 (define-key iris-function-map "\e[172q" [C-home])
290
291 ;(define-key iris-function-map "\e[A" [up])
292 (define-key iris-function-map "\e[182q" [C-up])
293
294
295 ;(define-key iris-function-map "\e[150q" [prior])
296 (define-key iris-function-map "\e[190q" [C-prior])
297
298
299 (define-key iris-function-map "\e[200q" [?\C-+])
300 (define-key iris-function-map "\e[201q" [?\M-+])
301
302 ;(define-key iris-function-map "\e[D" [left])
303 (define-key iris-function-map "\e[174q" [C-left])
304
305
306 (define-key iris-function-map "\e[000q" [begin])
307 (define-key iris-function-map "\e[184q" [C-begin])
308
309
310 ;(define-key iris-function-map "\e[C" [right])
311 (define-key iris-function-map "\e[192q" [C-right])
312
313 ;(define-key iris-function-map "\e[146q" [end])
314 (define-key iris-function-map "\e[176q" [C-end])
315
316 ;(define-key iris-function-map "\e[B" [down])
317 (define-key iris-function-map "\e[186q" [C-down])
318
319 ;(define-key iris-function-map "\e[154q" [next])
320 (define-key iris-function-map "\e[194q" [C-next])
321
322
323 (define-key iris-function-map "\e[100q" [M-enter])
324
325 (define-key iris-function-map "\e[139q" [insert])
326 (define-key iris-function-map "\e[178q" [C-inset])
327
328 (define-key iris-function-map "\e[P" [delete])
329 (define-key iris-function-map "\e[196q" [C-delete])
330 (define-key iris-function-map "\e[197q" [M-delete]))
331
332 (defun terminal-init-iris-ansi ()
333 "Terminal initialization function for iris-ansi."
334 ;; Use inheritance to let the main keymap override these defaults.
335 ;; This way we don't override terminfo-derived settings or settings
336 ;; made in the .emacs file.
337 (let ((m (copy-keymap iris-function-map)))
338 (set-keymap-parent m (keymap-parent (terminal-local-value 'local-function-key-map nil)))
339 (set-keymap-parent (terminal-local-value 'local-function-key-map nil) m)))
340
341 ;;; arch-tag: b1d0e73a-bb7d-47be-9fb2-6fb126469a1b
342 ;;; iris-ansi.el ends here