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