annotate lisp/term/rxvt.el @ 47287:0964618b0e97

(reftex-label-menu-flags): Fix typo.
author Juanma Barranquero <lekktu@gmail.com>
date Fri, 06 Sep 2002 10:11:48 +0000
parents 201a6b278692
children 5ade352e8d1c
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
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 2002 Free Software Foundation, Inc.
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
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
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
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
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
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
29 ;; Set up function-key-map entries that termcap and terminfo don't know.
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
30 (let ((map (make-sparse-keymap)))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
31 (define-key map "\e[A" [up])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
32 (define-key map "\e[B" [down])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
33 (define-key map "\e[C" [right])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
34 (define-key map "\e[D" [left])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
35 (define-key map "\e[7~" [home])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
36 (define-key map "\e[2~" [insert])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
37 (define-key map "\e[3~" [delete])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
38 (define-key map "\e[4~" [select])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
39 (define-key map "\e[5~" [prior])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
40 (define-key map "\e[6~" [next])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
41 (define-key map "\e[11~" [f1])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
42 (define-key map "\e[12~" [f2])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
43 (define-key map "\e[13~" [f3])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
44 (define-key map "\e[14~" [f4])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
45 (define-key map "\e[15~" [f5])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
46 (define-key map "\e[17~" [f6])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
47 (define-key map "\e[18~" [f7])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
48 (define-key map "\e[19~" [f8])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
49 (define-key map "\e[20~" [f9])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
50 (define-key map "\e[21~" [f10])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
51 (define-key map "\e[23~" [f11])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
52 (define-key map "\e[24~" [f12])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
53 (define-key map "\e[29~" [print])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
54
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
55 (define-key map "\e[11^" [C-f1])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
56 (define-key map "\e[12^" [C-f2])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
57 (define-key map "\e[13^" [C-f3])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
58 (define-key map "\e[14^" [C-f4])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
59 (define-key map "\e[15^" [C-f5])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
60 (define-key map "\e[17^" [C-f6])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
61 (define-key map "\e[18^" [C-f7])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
62 (define-key map "\e[19^" [C-f8])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
63 (define-key map "\e[20^" [C-f9])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
64 (define-key map "\e[21^" [C-f10])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
65 (define-key map "\e[23^" [C-f11])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
66 (define-key map "\e[24^" [C-f12])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
67
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
68 (define-key map "\e[29~" [print])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
69
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
70 (define-key map "\e[2;2~" [S-insert])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
71 (define-key map "\e[3$" [S-delete])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
72
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
73 (define-key map "\e[2^" [C-insert])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
74 (define-key map "\e[3^" [C-delete])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
75 (define-key map "\e[5^" [C-prior])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
76 (define-key map "\e[6^" [C-next])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
77 (define-key map "\eOd" [C-left])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
78 (define-key map "\eOc" [C-right])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
79 (define-key map "\eOa" [C-up])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
80 (define-key map "\eOb" [C-down])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
81
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
82 (define-key map "\e[5$" [S-prior])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
83 (define-key map "\e[6$" [S-next])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
84 (define-key map "\e[8$" [S-end])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
85 (define-key map "\e[7$" [S-home])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
86 (define-key map "\e[d" [S-left])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
87 (define-key map "\e[c" [S-right])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
88 (define-key map "\e[a" [S-up])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
89 (define-key map "\e[b" [S-down])
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
90
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
91 ;; Use inheritance to let the main keymap override those defaults.
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
92 ;; This way we don't override terminfo-derived settings or settings
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
93 ;; made in the .emacs file.
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
94 (set-keymap-parent map (keymap-parent function-key-map))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
95 (set-keymap-parent function-key-map map))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
96
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
97 ;; Set up colors, for those versions of rxvt that support it.
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
98 (defvar rxvt-standard-colors
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
99 ;; 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
100 ;; page; the corresponding RGB values--from rgb.txt.
42945
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
101 '(("black" 0 ( 0 0 0)) ; black
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
102 ("red" 1 (205 0 0)) ; red3
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
103 ("green" 2 ( 0 205 0)) ; green3
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
104 ("yellow" 3 (205 205 0)) ; yellow3
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
105 ("blue" 4 ( 0 0 205)) ; blue3
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
106 ("magenta" 5 (205 0 205)) ; magenta3
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
107 ("cyan" 6 ( 0 205 205)) ; cyan3
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
108 ("white" 7 (250 235 215)) ; AntiqueWhite
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
109 ("brightblack" 8 ( 64 64 64)) ; gray25
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
110 ("brightred" 9 (255 0 0)) ; red
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
111 ("brightgreen" 10 ( 0 255 0)) ; green
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
112 ("brightyellow" 11 (255 255 0)) ; yellow
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
113 ("brightblue" 12 ( 0 0 255)) ; blue
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
114 ("brightmagenta" 13 (255 0 255)) ; magenta
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
115 ("brightcyan" 14 ( 0 255 255)) ; cyan
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
116 ("brightwhite" 15 (255 255 255))) ; white
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
117 "Names of 16 standard rxvt colors, their numbers, and RGB values.")
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
118
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
119 (defun rxvt-rgb-convert-to-16bit (prim)
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
120 "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
121 (min 65535 (round (* (/ prim 255.0) 65535.0))))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
122
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
123 (defun rxvt-register-default-colors ()
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
124 "Register the default set of colors for rxvt or compatible emulator.
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
125
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
126 This function registers the number of colors returned by `display-color-cells'
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
127 for the currently selected frame."
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
128 (let* ((ncolors (display-color-cells))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
129 (colors rxvt-standard-colors)
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
130 (color (car colors)))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
131 (if (> ncolors 0)
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
132 ;; Clear the 8 default tty colors registered by startup.el
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
133 (tty-color-clear))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
134 ;; Only register as many colors as are supported by the display.
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
135 (while (and (> ncolors 0) colors)
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
136 (tty-color-define (car color) (cadr color)
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
137 (mapcar 'rxvt-rgb-convert-to-16bit
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
138 (car (cddr color))))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
139 (setq colors (cdr colors)
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
140 color (car colors)
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
141 ncolors (1- ncolors)))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
142 ;; Modifying color mappings means realized faces don't use the
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
143 ;; right colors, so clear them.
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
144 (clear-face-cache)))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
145
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
146 ;; rxvt puts the default colors into an environment variable
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
147 ;; COLORFGBG. We use this to set the background mode in a more
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
148 ;; intelligent way than the default guesswork in startup.el.
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
149 (defun rxvt-set-background-mode ()
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
150 "Set background mode as appropriate for the default rxvt colors."
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
151 (let ((fgbg (getenv "COLORFGBG"))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
152 bg rgb)
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
153 (setq frame-background-mode 'light) ; default
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
154 (when (and fgbg
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
155 (string-match ".*;\\([0-9][0-9]?\\)\\'" fgbg))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
156 (setq bg (string-to-number (substring fgbg (match-beginning 1))))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
157 ;; The next line assumes that rxvt-standard-colors are ordered
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
158 ;; by the color index in the ascending order!
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
159 (setq rgb (car (cddr (nth bg rxvt-standard-colors))))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
160 ;; See the commentary in frame-set-background-mode about the
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
161 ;; computation below.
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
162 (if (< (apply '+ rgb)
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
163 ;; The following line assumes that white is the 15th
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
164 ;; color in rxvt-standard-colors.
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
165 (* (apply '+ (car (cddr (nth 15 rxvt-standard-colors)))) 0.6))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
166 (setq frame-background-mode 'dark)))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
167 (frame-set-background-mode (selected-frame))))
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
168
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
169 ;; Do it!
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
170 (rxvt-register-default-colors)
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
171 (rxvt-set-background-mode)
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
172 ;; This recomputes all the default faces given the colors we've just set up.
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
173 (tty-set-up-initial-frame-faces)
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
174
b984e9bf0c85 New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
175 ;;; rxvt.el ends here