42945
|
1 ;;; rxvt.el --- define function key sequences and standard colors for rxvt
|
|
2
|
68648
|
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
42945
|
4
|
|
5 ;; Author: Eli Zaretskii
|
|
6 ;; Keywords: terminals
|
|
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 the
|
64084
|
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
23 ;; Boston, MA 02110-1301, USA.
|
42945
|
24
|
|
25 ;;; Commentary:
|
|
26
|
|
27 ;;; Code:
|
|
28
|
64651
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
29 (defun terminal-init-rxvt ()
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
30 "Terminal initialization function for rxvt."
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
31 ;; The terminal intialization C code file might have initialized
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
32 ;; function keys F11->F42 from the termcap/terminfo information. On
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
33 ;; a PC-style keyboard these keys correspond to
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
34 ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C-, C-S-. The
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
35 ;; code here subsitutes the corresponding defintions in
|
65621
|
36 ;; function-key-map. This substitution is needed because if a key
|
64651
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
37 ;; definition if found in function-key-map, there are no further
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
38 ;; lookups in other keymaps.
|
64701
|
39 (substitute-key-definition [f11] [S-f1] function-key-map)
|
64651
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
40 (substitute-key-definition [f12] [S-f2] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
41 (substitute-key-definition [f13] [S-f3] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
42 (substitute-key-definition [f14] [S-f4] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
43 (substitute-key-definition [f15] [S-f5] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
44 (substitute-key-definition [f16] [S-f6] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
45 (substitute-key-definition [f17] [S-f7] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
46 (substitute-key-definition [f18] [S-f8] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
47 (substitute-key-definition [f19] [S-f9] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
48 (substitute-key-definition [f20] [S-f10] function-key-map)
|
64596
d5254bde5ea5
* term/rxvt.el (function-key-map): Use substitute-key-definition
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
49
|
64701
|
50 (substitute-key-definition [f23] [C-f1] function-key-map)
|
64651
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
51 (substitute-key-definition [f24] [C-f2] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
52 (substitute-key-definition [f25] [C-f3] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
53 (substitute-key-definition [f26] [C-f4] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
54 (substitute-key-definition [f27] [C-f5] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
55 (substitute-key-definition [f28] [C-f6] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
56 (substitute-key-definition [f29] [C-f7] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
57 (substitute-key-definition [f30] [C-f8] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
58 (substitute-key-definition [f31] [C-f9] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
59 (substitute-key-definition [f32] [C-f10] function-key-map)
|
64596
d5254bde5ea5
* term/rxvt.el (function-key-map): Use substitute-key-definition
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
60
|
64701
|
61 (substitute-key-definition [f33] [C-S-f1] function-key-map)
|
64651
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
62 (substitute-key-definition [f34] [C-S-f2] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
63 (substitute-key-definition [f35] [C-S-f3] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
64 (substitute-key-definition [f36] [C-S-f4] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
65 (substitute-key-definition [f37] [C-S-f5] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
66 (substitute-key-definition [f38] [C-S-f6] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
67 (substitute-key-definition [f39] [C-S-f7] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
68 (substitute-key-definition [f40] [C-S-f8] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
69 (substitute-key-definition [f41] [C-S-f9] function-key-map)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
70 (substitute-key-definition [f42] [C-S-f10] function-key-map)
|
64596
d5254bde5ea5
* term/rxvt.el (function-key-map): Use substitute-key-definition
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
71
|
64651
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
72 ;; Set up function-key-map entries that termcap and terminfo don't know.
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
73 (let ((map (make-sparse-keymap)))
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
74 (define-key map "\e[A" [up])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
75 (define-key map "\e[B" [down])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
76 (define-key map "\e[C" [right])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
77 (define-key map "\e[D" [left])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
78 (define-key map "\e[2~" [insert])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
79 (define-key map "\e[3~" [delete])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
80 (define-key map "\e[4~" [select])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
81 (define-key map "\e[5~" [prior])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
82 (define-key map "\e[6~" [next])
|
65621
|
83 (define-key map "\e[7~" [home])
|
|
84 (define-key map "\e[8~" [end])
|
64651
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
85 (define-key map "\e[11~" [f1])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
86 (define-key map "\e[12~" [f2])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
87 (define-key map "\e[13~" [f3])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
88 (define-key map "\e[14~" [f4])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
89 (define-key map "\e[15~" [f5])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
90 (define-key map "\e[17~" [f6])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
91 (define-key map "\e[18~" [f7])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
92 (define-key map "\e[19~" [f8])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
93 (define-key map "\e[20~" [f9])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
94 (define-key map "\e[21~" [f10])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
95 ;; The strings emitted by f11 and f12 are the same as the strings
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
96 ;; emitted by S-f1 and S-f2, so don't define f11 and f12.
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
97 ;; (define-key map "\e[23~" [f11])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
98 ;; (define-key map "\e[24~" [f12])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
99 (define-key map "\e[29~" [print])
|
42945
|
100
|
64651
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
101 (define-key map "\e[11^" [C-f1])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
102 (define-key map "\e[12^" [C-f2])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
103 (define-key map "\e[13^" [C-f3])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
104 (define-key map "\e[14^" [C-f4])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
105 (define-key map "\e[15^" [C-f5])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
106 (define-key map "\e[17^" [C-f6])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
107 (define-key map "\e[18^" [C-f7])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
108 (define-key map "\e[19^" [C-f8])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
109 (define-key map "\e[20^" [C-f9])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
110 (define-key map "\e[21^" [C-f10])
|
42945
|
111
|
64651
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
112 (define-key map "\e[23~" [S-f1])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
113 (define-key map "\e[24~" [S-f2])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
114 (define-key map "\e[25~" [S-f3])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
115 (define-key map "\e[26~" [S-f4])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
116 (define-key map "\e[28~" [S-f5])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
117 (define-key map "\e[29~" [S-f6])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
118 (define-key map "\e[31~" [S-f7])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
119 (define-key map "\e[32~" [S-f8])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
120 (define-key map "\e[33~" [S-f9])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
121 (define-key map "\e[34~" [S-f10])
|
42945
|
122
|
64651
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
123 (define-key map "\e[23^" [C-S-f1])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
124 (define-key map "\e[24^" [C-S-f2])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
125 (define-key map "\e[25^" [C-S-f3])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
126 (define-key map "\e[26^" [C-S-f4])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
127 (define-key map "\e[28^" [C-S-f5])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
128 (define-key map "\e[29^" [C-S-f6])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
129 (define-key map "\e[31^" [C-S-f7])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
130 (define-key map "\e[32^" [C-S-f8])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
131 (define-key map "\e[33^" [C-S-f9])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
132 (define-key map "\e[34^" [C-S-f10])
|
42945
|
133
|
64651
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
134 (define-key map "\e[2^" [C-insert])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
135 (define-key map "\e[3^" [C-delete])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
136 (define-key map "\e[5^" [C-prior])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
137 (define-key map "\e[6^" [C-next])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
138 (define-key map "\e[7^" [C-home])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
139 (define-key map "\e[8^" [C-end])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
140 (define-key map "\eOd" [C-left])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
141 (define-key map "\eOc" [C-right])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
142 (define-key map "\eOa" [C-up])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
143 (define-key map "\eOb" [C-down])
|
49599
|
144
|
64651
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
145 (define-key map "\e[2;2~" [S-insert])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
146 (define-key map "\e[3$" [S-delete])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
147 (define-key map "\e[5$" [S-prior])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
148 (define-key map "\e[6$" [S-next])
|
65650
|
149 (define-key map "\e[7$" [S-home])
|
64651
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
150 (define-key map "\e[8$" [S-end])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
151 (define-key map "\e[d" [S-left])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
152 (define-key map "\e[c" [S-right])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
153 (define-key map "\e[a" [S-up])
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
154 (define-key map "\e[b" [S-down])
|
42945
|
155
|
64651
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
156 ;; Use inheritance to let the main keymap override those defaults.
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
157 ;; This way we don't override terminfo-derived settings or settings
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
158 ;; made in the .emacs file.
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
159 (set-keymap-parent map (keymap-parent function-key-map))
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
160 (set-keymap-parent function-key-map map))
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
161
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
162 ;; Initialize colors and background mode.
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
163 (rxvt-register-default-colors)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
164 (rxvt-set-background-mode)
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
165 ;; This recomputes all the default faces given the colors we've just set up.
|
af1c58687bdd
* term/apollo.el (terminal-init-apollo): New function containing
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
166 (tty-set-up-initial-frame-faces))
|
42945
|
167
|
|
168 ;; Set up colors, for those versions of rxvt that support it.
|
|
169 (defvar rxvt-standard-colors
|
|
170 ;; The names of the colors in the comments taken from the rxvt.1 man
|
42962
|
171 ;; page; the corresponding RGB values--from rgb.txt.
|
42945
|
172 '(("black" 0 ( 0 0 0)) ; black
|
|
173 ("red" 1 (205 0 0)) ; red3
|
|
174 ("green" 2 ( 0 205 0)) ; green3
|
|
175 ("yellow" 3 (205 205 0)) ; yellow3
|
|
176 ("blue" 4 ( 0 0 205)) ; blue3
|
|
177 ("magenta" 5 (205 0 205)) ; magenta3
|
|
178 ("cyan" 6 ( 0 205 205)) ; cyan3
|
65639
|
179 ("white" 7 (229 229 229)) ; gray90
|
|
180 ("brightblack" 8 ( 77 77 77)) ; gray30
|
42945
|
181 ("brightred" 9 (255 0 0)) ; red
|
|
182 ("brightgreen" 10 ( 0 255 0)) ; green
|
|
183 ("brightyellow" 11 (255 255 0)) ; yellow
|
|
184 ("brightblue" 12 ( 0 0 255)) ; blue
|
|
185 ("brightmagenta" 13 (255 0 255)) ; magenta
|
|
186 ("brightcyan" 14 ( 0 255 255)) ; cyan
|
|
187 ("brightwhite" 15 (255 255 255))) ; white
|
|
188 "Names of 16 standard rxvt colors, their numbers, and RGB values.")
|
|
189
|
|
190 (defun rxvt-rgb-convert-to-16bit (prim)
|
|
191 "Convert an 8-bit primary color value PRIM to a corresponding 16-bit value."
|
|
192 (min 65535 (round (* (/ prim 255.0) 65535.0))))
|
|
193
|
|
194 (defun rxvt-register-default-colors ()
|
|
195 "Register the default set of colors for rxvt or compatible emulator.
|
|
196
|
|
197 This function registers the number of colors returned by `display-color-cells'
|
|
198 for the currently selected frame."
|
|
199 (let* ((ncolors (display-color-cells))
|
|
200 (colors rxvt-standard-colors)
|
|
201 (color (car colors)))
|
|
202 (if (> ncolors 0)
|
|
203 ;; Clear the 8 default tty colors registered by startup.el
|
|
204 (tty-color-clear))
|
|
205 ;; Only register as many colors as are supported by the display.
|
|
206 (while (and (> ncolors 0) colors)
|
|
207 (tty-color-define (car color) (cadr color)
|
|
208 (mapcar 'rxvt-rgb-convert-to-16bit
|
|
209 (car (cddr color))))
|
|
210 (setq colors (cdr colors)
|
|
211 color (car colors)
|
|
212 ncolors (1- ncolors)))
|
65687
|
213 (when (> ncolors 0)
|
|
214 (cond
|
|
215 ((= ncolors 240) ; 256-color rxvt
|
|
216 ;; 216 non-gray colors first
|
|
217 (let ((r 0) (g 0) (b 0))
|
|
218 (while (> ncolors 24)
|
|
219 ;; This and other formulae taken from 256colres.pl and
|
|
220 ;; 88colres.pl in the xterm distribution.
|
|
221 (tty-color-define (format "color-%d" (- 256 ncolors))
|
|
222 (- 256 ncolors)
|
|
223 (mapcar 'rxvt-rgb-convert-to-16bit
|
|
224 (list (round (* r 42.5))
|
|
225 (round (* g 42.5))
|
|
226 (round (* b 42.5)))))
|
|
227 (setq b (1+ b))
|
|
228 (if (> b 5)
|
|
229 (setq g (1+ g)
|
|
230 b 0))
|
|
231 (if (> g 5)
|
|
232 (setq r (1+ r)
|
|
233 g 0))
|
|
234 (setq ncolors (1- ncolors))))
|
|
235 ;; Now the 24 gray colors
|
|
236 (while (> ncolors 0)
|
|
237 (setq color (rxvt-rgb-convert-to-16bit (+ 8 (* (- 24 ncolors) 10))))
|
|
238 (tty-color-define (format "color-%d" (- 256 ncolors))
|
|
239 (- 256 ncolors)
|
|
240 (list color color color))
|
|
241 (setq ncolors (1- ncolors))))
|
|
242
|
65690
dc239a66e600
* term/rxvt.el (rxvt-register-default-colors): Delete redundant
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
243 ((= ncolors 72) ; rxvt-unicode
|
65687
|
244 ;; 64 non-gray colors
|
|
245 (let ((levels '(0 139 205 255))
|
|
246 (r 0) (g 0) (b 0))
|
|
247 (while (> ncolors 8)
|
|
248 (tty-color-define (format "color-%d" (- 88 ncolors))
|
|
249 (- 88 ncolors)
|
|
250 (mapcar 'rxvt-rgb-convert-to-16bit
|
|
251 (list (nth r levels)
|
|
252 (nth g levels)
|
|
253 (nth b levels))))
|
|
254 (setq b (1+ b))
|
|
255 (if (> b 3)
|
|
256 (setq g (1+ g)
|
|
257 b 0))
|
|
258 (if (> g 3)
|
|
259 (setq r (1+ r)
|
|
260 g 0))
|
|
261 (setq ncolors (1- ncolors))))
|
|
262 ;; Now the 8 gray colors
|
|
263 (while (> ncolors 0)
|
|
264 (setq color (rxvt-rgb-convert-to-16bit
|
|
265 (floor
|
|
266 (if (= ncolors 8)
|
|
267 46.36363636
|
|
268 (+ (* (- 8 ncolors) 23.18181818) 69.54545454)))))
|
65686
4a796295f477
* term/rxvt.el (rxvt-register-default-colors): Add support for 88
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
269 (tty-color-define (format "color-%d" (- 88 ncolors))
|
4a796295f477
* term/rxvt.el (rxvt-register-default-colors): Add support for 88
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
270 (- 88 ncolors)
|
65687
|
271 (list color color color))
|
65686
4a796295f477
* term/rxvt.el (rxvt-register-default-colors): Add support for 88
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
272 (setq ncolors (1- ncolors))))
|
65687
|
273 (t (error "Unsupported number of rxvt colors (%d)" (+ 16 ncolors)))))
|
42945
|
274 ;; Modifying color mappings means realized faces don't use the
|
|
275 ;; right colors, so clear them.
|
|
276 (clear-face-cache)))
|
|
277
|
|
278 ;; rxvt puts the default colors into an environment variable
|
|
279 ;; COLORFGBG. We use this to set the background mode in a more
|
|
280 ;; intelligent way than the default guesswork in startup.el.
|
|
281 (defun rxvt-set-background-mode ()
|
|
282 "Set background mode as appropriate for the default rxvt colors."
|
|
283 (let ((fgbg (getenv "COLORFGBG"))
|
|
284 bg rgb)
|
63861
|
285 (setq default-frame-background-mode 'light)
|
42945
|
286 (when (and fgbg
|
|
287 (string-match ".*;\\([0-9][0-9]?\\)\\'" fgbg))
|
|
288 (setq bg (string-to-number (substring fgbg (match-beginning 1))))
|
|
289 ;; The next line assumes that rxvt-standard-colors are ordered
|
|
290 ;; by the color index in the ascending order!
|
|
291 (setq rgb (car (cddr (nth bg rxvt-standard-colors))))
|
|
292 ;; See the commentary in frame-set-background-mode about the
|
|
293 ;; computation below.
|
|
294 (if (< (apply '+ rgb)
|
|
295 ;; The following line assumes that white is the 15th
|
|
296 ;; color in rxvt-standard-colors.
|
|
297 (* (apply '+ (car (cddr (nth 15 rxvt-standard-colors)))) 0.6))
|
63861
|
298 (setq default-frame-background-mode 'dark)))
|
42945
|
299 (frame-set-background-mode (selected-frame))))
|
|
300
|
65621
|
301 ;; arch-tag: 20cf2fb6-6318-4bab-9dbf-1d15048f2257
|
42945
|
302 ;;; rxvt.el ends here
|