1 ;;; iris-ansi.el --- configure Emacs for SGI xwsh and winterm apps -*- no-byte-compile: t -*-
3 ;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005,
4 ;; 2006, 2007, 2008 Free Software Foundation, Inc.
6 ;; Author: Dan Nicolaescu <dann@ics.uci.edu>
8 ;; This file is part of GNU Emacs.
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)
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.
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.
29 (defvar iris-function-map
30 (let ((map (make-sparse-keymap)))
32 (define-key map
"\e[120q" [S-escape
])
33 (define-key map
"\e[121q" [C-escape
])
35 (define-key map
"\e[001q" [f1])
36 (define-key map "\e[013q" [S-f1])
37 (define-key map "\e[025q" [C-f1])
40 (define-key map "\e[002q" [f2])
41 (define-key map "\e[014q" [S-f2])
42 (define-key map "\e[026q" [C-f2])
43 (define-key map "\e[038q" [M-f2])
45 (define-key map "\e[003q" [f3])
46 (define-key map "\e[015q" [S-f3])
47 (define-key map "\e[027q" [C-f3])
50 (define-key map "\e[004q" [f4])
51 (define-key map "\e[016q" [S-f4])
52 (define-key map "\e[028q" [C-f4])
55 (define-key map "\e[005q" [f5])
56 (define-key map "\e[017q" [S-f5])
57 (define-key map "\e[029q" [C-f5])
60 (define-key map "\e[006q" [f6])
61 (define-key map "\e[018q" [S-f6])
62 (define-key map "\e[030q" [C-f6])
65 (define-key map "\e[007q" [f7])
66 (define-key map "\e[019q" [S-f7])
67 (define-key map "\e[031q" [C-f7])
70 (define-key map "\e[008q" [f8])
71 (define-key map "\e[020q" [S-f8])
72 (define-key map "\e[032q" [C-f8])
75 (define-key map "\e[009q" [f9])
76 (define-key map "\e[021q" [S-f9])
77 (define-key map "\e[033q" [C-f9])
80 (define-key map "\e[010q" [f10])
81 (define-key map "\e[022q" [S-f10])
82 (define-key map "\e[034q" [C-f10])
85 (define-key map "\e[011q" [f11])
86 (define-key map "\e[023q" [S-f11])
87 (define-key map "\e[035q" [C-f11])
88 (define-key map "\e[047q" [M-f11])
90 (define-key map "\e[012q" [f12])
91 (define-key map "\e[024q" [S-f12])
92 (define-key map "\e[036q" [C-f12])
93 (define-key map "\e[048q" [M-f12])
96 (define-key map "\e[057q" [?\C-`])
97 (define-key map "\e[115q" [?\M-`])
99 (define-key map "\e[049q" [?\C-1])
100 (define-key map "\e[058q" [?\M-1])
103 (define-key map "\e[059q" [?\M-2])
105 (define-key map "\e[050q" [?\C-3])
106 (define-key map "\e[060q" [?\M-3])
108 (define-key map "\e[051q" [?\C-4])
109 (define-key map "\e[061q" [?\M-4])
111 (define-key map "\e[052q" [?\C-5])
112 (define-key map "\e[062q" [?\M-5])
115 (define-key map "\e[063q" [?\M-6])
117 (define-key map "\e[053q" [?\C-7])
118 (define-key map "\e[064q" [?\M-7])
120 (define-key map "\e[054q" [?\C-8])
121 (define-key map "\e[065q" [?\M-8])
123 (define-key map "\e[055q" [?\C-9])
124 (define-key map "\e[066q" [?\M-9])
126 (define-key map "\e[056q" [?\C-0])
127 (define-key map "\e[067q" [?\M-0])
129 (define-key map "\e[068q" [?\M--])
131 (define-key map "\e[069q" [?\C-=])
132 (define-key map "\e[070q" [?\M-=])
134 ;; I don't know what to do with those.
135 ;;(define-key map "^H" [<del>])
136 ;;(define-key map "^H" [S-<del>])
137 ;;(define-key map "\177" [C-<del>])
138 ;;(define-key map "\e[071q" [M-<del>])
140 (define-key map "\e[Z" [?\S-\t])
141 (define-key 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 map "\e[073q" [?\M-\t])
146 (define-key map "\e[074q" [?\M-q])
148 (define-key map "\e[075q" [?\M-w])
150 (define-key map "\e[076q" [?\M-e])
152 (define-key map "\e[077q" [?\M-r])
154 (define-key map "\e[078q" [?\M-t])
156 (define-key map "\e[079q" [?\M-y])
158 (define-key map "\e[080q" [?\M-u])
160 (define-key map "\e[081q" [?\M-i])
162 (define-key map "\e[082q" [?\M-o])
164 (define-key map "\e[083q" [?\M-p])
166 (define-key map "\e[084q" [?\M-\[])
168 (define-key map "\e[085q" [?\M-\]])
170 (define-key map "\e[086q" [?\M-\\])
172 (define-key map "\e[087q" [?\M-a])
174 (define-key map "\e[088q" [?\M-s])
176 (define-key map "\e[089q" [?\M-d])
178 (define-key map "\e[090q" [?\M-f])
180 (define-key map "\e[091q" [?\M-g])
182 (define-key map "\e[092q" [?\M-h])
184 (define-key map "\e[093q" [?\M-j])
186 (define-key map "\e[094q" [?\M-k])
188 (define-key map "\e[095q" [?\M-l])
190 (define-key map "\e[096q" [?\C-\;])
191 ;; We are cheating here, this is really M-;, but M-: generates the same
192 ;; string and is more useful.
193 (define-key map "\e[097q" [?\M-:])
195 (define-key map "\e[098q" [?\C-'])
196 (define-key map "\e[099q" [?\M-'])
198 (define-key map "\e[100q" [?\M-\n])
200 (define-key map "\e[101q" [?\M-z])
202 (define-key map "\e[102q" [?\M-x])
204 (define-key map "\e[103q" [?\M-c])
206 (define-key map "\e[104q" [?\M-v])
208 (define-key map "\e[105q" [?\M-b])
210 (define-key map "\e[106q" [M-n])
212 (define-key map "\e[107q" [M-m])
214 (define-key map "\e[108q" [?\C-,])
215 (define-key map "\e[109q" [?\M-,])
217 (define-key map "\e[110q" [?\C-.])
218 (define-key map "\e[111q" [?\M-.])
220 (define-key map "\e[112q" [?\C-/])
221 (define-key map "\e[113q" [?\M-/])
223 (define-key map "\e[139q" [insert])
224 (define-key map "\e[139q" [S-insert])
225 (define-key map "\e[140q" [C-insert])
226 (define-key map "\e[141q" [M-insert])
228 (define-key map "\e[H" [home])
229 (define-key map "\e[143q" [S-home])
230 (define-key map "\e[144q" [C-home])
233 (define-key map "\e[150q" [prior])
234 (define-key map "\e[151q" [S-prior]) ;Those don't seem to generate anything.
235 (define-key map "\e[152q" [C-prior])
238 ;; (define-key map "^?" [delete]) ?? something else seems to take care of this.
239 (define-key map "\e[P" [S-delete])
240 (define-key map "\e[142q" [C-delete])
241 (define-key map "\e[M" [M-delete])
243 (define-key map "\e[146q" [end])
244 (define-key map "\e[147q" [S-end]) ; Those don't seem to generate anything.
245 (define-key map "\e[148q" [C-end])
247 (define-key map "\e[154q" [next])
248 (define-key map "\e[155q" [S-next])
249 (define-key map "\e[156q" [C-next])
252 (define-key map "\e[161q" [S-up])
253 (define-key map "\e[162q" [C-up])
254 (define-key map "\e[163q" [M-up])
256 (define-key map "\e[158q" [S-left])
257 (define-key map "\e[159q" [C-left])
258 (define-key map "\e[160q" [M-left])
260 (define-key map "\e[164q" [S-down])
261 (define-key map "\e[165q" [C-down])
262 (define-key map "\e[166q" [M-down])
264 (define-key map "\e[167q" [S-right])
265 (define-key map "\e[168q" [C-right])
266 (define-key map "\e[169q" [M-right])
268 ;; Keypad functions, most of those are untested.
269 (define-key map "\e[179q" [?\C-/])
270 (define-key map "\e[180q" [?\M-/])
272 (define-key map "\e[187q" [?\C-*])
273 (define-key map "\e[188q" [?\M-*])
275 (define-key map "\e[198q" [?\C--])
276 (define-key map "\e[199q" [?\M--])
278 ;; Something else takes care of home, up, prior, down, left, right, next
279 ;;(define-key map "\e[H" [home])
280 (define-key map "\e[172q" [C-home])
282 ;;(define-key map "\e[A" [up])
283 (define-key map "\e[182q" [C-up])
286 ;;(define-key map "\e[150q" [prior])
287 (define-key map "\e[190q" [C-prior])
290 (define-key map "\e[200q" [?\C-+])
291 (define-key map "\e[201q" [?\M-+])
293 ;;(define-key map "\e[D" [left])
294 (define-key map "\e[174q" [C-left])
297 (define-key map "\e[000q" [begin])
298 (define-key map "\e[184q" [C-begin])
301 ;;(define-key map "\e[C" [right])
302 (define-key map "\e[192q" [C-right])
304 ;;(define-key map "\e[146q" [end])
305 (define-key map "\e[176q" [C-end])
307 ;;(define-key map "\e[B" [down])
308 (define-key map "\e[186q" [C-down])
310 ;;(define-key map "\e[154q" [next])
311 (define-key map "\e[194q" [C-next])
313 (define-key map "\e[100q" [M-enter])
315 (define-key map "\e[139q" [insert])
316 (define-key map "\e[178q" [C-inset])
318 (define-key map "\e[P" [delete])
319 (define-key map "\e[196q" [C-delete])
320 (define-key map "\e[197q" [M-delete])
322 "Function key definitions for SGI xwsh and winterm apps.")
324 (defun terminal-init-iris-ansi ()
325 "Terminal initialization function for iris-ansi."
326 ;; Use inheritance to let the main keymap override these defaults.
327 ;; This way we don't override terminfo-derived settings or settings
328 ;; made in the .emacs file.
329 (let ((m (copy-keymap iris-function-map)))
330 (set-keymap-parent m (keymap-parent input-decode-map))
331 (set-keymap-parent input-decode-map m)))
333 ;; arch-tag: b1d0e73a-bb7d-47be-9fb2-6fb126469a1b
334 ;;; iris-ansi.el ends here