annotate lisp/term/rxvt.el @ 87565:c27df69a8670

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