1 ;;; iris-ansi.el --- configure Emacs for SGI xwsh and winterm apps
3 ;; Copyright (C) 1997, 2001-2014 Free Software Foundation, Inc.
5 ;; Author: Dan Nicolaescu <dann@ics.uci.edu>
7 ;; This file is part of GNU Emacs.
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 3 of the License, or
12 ;; (at your option) any later version.
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.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 (defvar iris-function-map
27 (let ((map (make-sparse-keymap)))
29 (define-key map
"\e[120q" [S-escape
])
30 (define-key map
"\e[121q" [C-escape
])
32 (define-key map
"\e[001q" [f1])
33 (define-key map "\e[013q" [S-f1])
34 (define-key map "\e[025q" [C-f1])
37 (define-key map "\e[002q" [f2])
38 (define-key map "\e[014q" [S-f2])
39 (define-key map "\e[026q" [C-f2])
40 (define-key map "\e[038q" [M-f2])
42 (define-key map "\e[003q" [f3])
43 (define-key map "\e[015q" [S-f3])
44 (define-key map "\e[027q" [C-f3])
47 (define-key map "\e[004q" [f4])
48 (define-key map "\e[016q" [S-f4])
49 (define-key map "\e[028q" [C-f4])
52 (define-key map "\e[005q" [f5])
53 (define-key map "\e[017q" [S-f5])
54 (define-key map "\e[029q" [C-f5])
57 (define-key map "\e[006q" [f6])
58 (define-key map "\e[018q" [S-f6])
59 (define-key map "\e[030q" [C-f6])
62 (define-key map "\e[007q" [f7])
63 (define-key map "\e[019q" [S-f7])
64 (define-key map "\e[031q" [C-f7])
67 (define-key map "\e[008q" [f8])
68 (define-key map "\e[020q" [S-f8])
69 (define-key map "\e[032q" [C-f8])
72 (define-key map "\e[009q" [f9])
73 (define-key map "\e[021q" [S-f9])
74 (define-key map "\e[033q" [C-f9])
77 (define-key map "\e[010q" [f10])
78 (define-key map "\e[022q" [S-f10])
79 (define-key map "\e[034q" [C-f10])
82 (define-key map "\e[011q" [f11])
83 (define-key map "\e[023q" [S-f11])
84 (define-key map "\e[035q" [C-f11])
85 (define-key map "\e[047q" [M-f11])
87 (define-key map "\e[012q" [f12])
88 (define-key map "\e[024q" [S-f12])
89 (define-key map "\e[036q" [C-f12])
90 (define-key map "\e[048q" [M-f12])
93 (define-key map "\e[057q" [?\C-`])
94 (define-key map "\e[115q" [?\M-`])
96 (define-key map "\e[049q" [?\C-1])
97 (define-key map "\e[058q" [?\M-1])
100 (define-key map "\e[059q" [?\M-2])
102 (define-key map "\e[050q" [?\C-3])
103 (define-key map "\e[060q" [?\M-3])
105 (define-key map "\e[051q" [?\C-4])
106 (define-key map "\e[061q" [?\M-4])
108 (define-key map "\e[052q" [?\C-5])
109 (define-key map "\e[062q" [?\M-5])
112 (define-key map "\e[063q" [?\M-6])
114 (define-key map "\e[053q" [?\C-7])
115 (define-key map "\e[064q" [?\M-7])
117 (define-key map "\e[054q" [?\C-8])
118 (define-key map "\e[065q" [?\M-8])
120 (define-key map "\e[055q" [?\C-9])
121 (define-key map "\e[066q" [?\M-9])
123 (define-key map "\e[056q" [?\C-0])
124 (define-key map "\e[067q" [?\M-0])
126 (define-key map "\e[068q" [?\M--])
128 (define-key map "\e[069q" [?\C-=])
129 (define-key map "\e[070q" [?\M-=])
131 ;; I don't know what to do with those.
132 ;;(define-key map "^H" [<del>])
133 ;;(define-key map "^H" [S-<del>])
134 ;;(define-key map "\177" [C-<del>])
135 ;;(define-key map "\e[071q" [M-<del>])
137 (define-key map "\e[Z" [?\S-\t])
138 (define-key map "\e[072q" [?\C-\t])
139 ;; This only works if you remove the M-TAB keybinding from the system.4Dwmrc
140 ;; or your ~/.4Dwmrc, if you use the 4Dwm window manager.
141 (define-key map "\e[073q" [?\M-\t])
143 (define-key map "\e[074q" [?\M-q])
145 (define-key map "\e[075q" [?\M-w])
147 (define-key map "\e[076q" [?\M-e])
149 (define-key map "\e[077q" [?\M-r])
151 (define-key map "\e[078q" [?\M-t])
153 (define-key map "\e[079q" [?\M-y])
155 (define-key map "\e[080q" [?\M-u])
157 (define-key map "\e[081q" [?\M-i])
159 (define-key map "\e[082q" [?\M-o])
161 (define-key map "\e[083q" [?\M-p])
163 (define-key map "\e[084q" [?\M-\[])
165 (define-key map "\e[085q" [?\M-\]])
167 (define-key map "\e[086q" [?\M-\\])
169 (define-key map "\e[087q" [?\M-a])
171 (define-key map "\e[088q" [?\M-s])
173 (define-key map "\e[089q" [?\M-d])
175 (define-key map "\e[090q" [?\M-f])
177 (define-key map "\e[091q" [?\M-g])
179 (define-key map "\e[092q" [?\M-h])
181 (define-key map "\e[093q" [?\M-j])
183 (define-key map "\e[094q" [?\M-k])
185 (define-key map "\e[095q" [?\M-l])
187 (define-key map "\e[096q" [?\C-\;])
188 ;; We are cheating here, this is really M-;, but M-: generates the same
189 ;; string and is more useful.
190 (define-key map "\e[097q" [?\M-:])
192 (define-key map "\e[098q" [?\C-'])
193 (define-key map "\e[099q" [?\M-'])
195 (define-key map "\e[100q" [?\M-\n])
197 (define-key map "\e[101q" [?\M-z])
199 (define-key map "\e[102q" [?\M-x])
201 (define-key map "\e[103q" [?\M-c])
203 (define-key map "\e[104q" [?\M-v])
205 (define-key map "\e[105q" [?\M-b])
207 (define-key map "\e[106q" [M-n])
209 (define-key map "\e[107q" [M-m])
211 (define-key map "\e[108q" [?\C-,])
212 (define-key map "\e[109q" [?\M-,])
214 (define-key map "\e[110q" [?\C-.])
215 (define-key map "\e[111q" [?\M-.])
217 (define-key map "\e[112q" [?\C-/])
218 (define-key map "\e[113q" [?\M-/])
220 (define-key map "\e[139q" [insert])
221 (define-key map "\e[139q" [S-insert])
222 (define-key map "\e[140q" [C-insert])
223 (define-key map "\e[141q" [M-insert])
225 (define-key map "\e[H" [home])
226 (define-key map "\e[143q" [S-home])
227 (define-key map "\e[144q" [C-home])
230 (define-key map "\e[150q" [prior])
231 (define-key map "\e[151q" [S-prior]) ;Those don't seem to generate anything.
232 (define-key map "\e[152q" [C-prior])
235 ;; (define-key map "^?" [delete]) ?? something else seems to take care of this.
236 (define-key map "\e[P" [S-delete])
237 (define-key map "\e[142q" [C-delete])
238 (define-key map "\e[M" [M-delete])
240 (define-key map "\e[146q" [end])
241 (define-key map "\e[147q" [S-end]) ; Those don't seem to generate anything.
242 (define-key map "\e[148q" [C-end])
244 (define-key map "\e[154q" [next])
245 (define-key map "\e[155q" [S-next])
246 (define-key map "\e[156q" [C-next])
249 (define-key map "\e[161q" [S-up])
250 (define-key map "\e[162q" [C-up])
251 (define-key map "\e[163q" [M-up])
253 (define-key map "\e[158q" [S-left])
254 (define-key map "\e[159q" [C-left])
255 (define-key map "\e[160q" [M-left])
257 (define-key map "\e[164q" [S-down])
258 (define-key map "\e[165q" [C-down])
259 (define-key map "\e[166q" [M-down])
261 (define-key map "\e[167q" [S-right])
262 (define-key map "\e[168q" [C-right])
263 (define-key map "\e[169q" [M-right])
265 ;; Keypad functions, most of those are untested.
266 (define-key map "\e[179q" [?\C-/])
267 (define-key map "\e[180q" [?\M-/])
269 (define-key map "\e[187q" [?\C-*])
270 (define-key map "\e[188q" [?\M-*])
272 (define-key map "\e[198q" [?\C--])
273 (define-key map "\e[199q" [?\M--])
275 ;; Something else takes care of home, up, prior, down, left, right, next
276 ;;(define-key map "\e[H" [home])
277 (define-key map "\e[172q" [C-home])
279 ;;(define-key map "\e[A" [up])
280 (define-key map "\e[182q" [C-up])
283 ;;(define-key map "\e[150q" [prior])
284 (define-key map "\e[190q" [C-prior])
287 (define-key map "\e[200q" [?\C-+])
288 (define-key map "\e[201q" [?\M-+])
290 ;;(define-key map "\e[D" [left])
291 (define-key map "\e[174q" [C-left])
294 (define-key map "\e[000q" [begin])
295 (define-key map "\e[184q" [C-begin])
298 ;;(define-key map "\e[C" [right])
299 (define-key map "\e[192q" [C-right])
301 ;;(define-key map "\e[146q" [end])
302 (define-key map "\e[176q" [C-end])
304 ;;(define-key map "\e[B" [down])
305 (define-key map "\e[186q" [C-down])
307 ;;(define-key map "\e[154q" [next])
308 (define-key map "\e[194q" [C-next])
310 (define-key map "\e[100q" [M-enter])
312 (define-key map "\e[139q" [insert])
313 (define-key map "\e[178q" [C-inset])
315 (define-key map "\e[P" [delete])
316 (define-key map "\e[196q" [C-delete])
317 (define-key map "\e[197q" [M-delete])
319 "Function key definitions for SGI xwsh and winterm apps.")
321 (defun terminal-init-iris-ansi ()
322 "Terminal initialization function for iris-ansi."
323 ;; Use inheritance to let the main keymap override these defaults.
324 ;; This way we don't override terminfo-derived settings or settings
325 ;; made in the init file.
326 (let ((m (copy-keymap iris-function-map)))
327 (set-keymap-parent m (keymap-parent input-decode-map))
328 (set-keymap-parent input-decode-map m)))
330 ;;; iris-ansi.el ends here