Mercurial > emacs
annotate lisp/term/x-win.el @ 4246:af9d2ade78ed
(x-select-text): Always set the cut buffer,
but sometimes set it to nothing. Don't put large strings in clipboard.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 23 Jul 1993 17:24:45 +0000 |
parents | 8e14db210975 |
children | 79dc5c3370f8 |
rev | line source |
---|---|
2157
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
1 ;;; x-win.el --- parse switches controlling interface with X window system |
3287 | 2 ;; Copyright (C) 1993 Free Software Foundation, Inc. |
2157
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
3 |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
4 ;; Author: FSF |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
5 ;; Keywords: terminals |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
6 |
3287 | 7 ;;; This file is part of GNU Emacs. |
8 ;;; | |
9 ;;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;;; it under the terms of the GNU General Public License as published by | |
11 ;;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;;; any later version. | |
13 ;;; | |
14 ;;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;;; GNU General Public License for more details. | |
18 ;;; | |
19 ;;; You should have received a copy of the GNU General Public License | |
20 ;;; along with GNU Emacs; see the file COPYING. If not, write to | |
21 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
54 | 22 |
2157
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
23 ;;; Commentary: |
54 | 24 |
25 ;; X-win.el: this file is loaded from ../lisp/startup.el when it recognizes | |
26 ;; that X windows are to be used. Command line switches are parsed and those | |
27 ;; pertaining to X are processed and removed from the command line. The | |
28 ;; X display is opened and hooks are set for popping up the initial window. | |
29 | |
30 ;; startup.el will then examine startup files, and eventually call the hooks | |
31 ;; which create the first window (s). | |
2157
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
32 |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
33 ;;; Code: |
54 | 34 |
35 ;; These are the standard X switches from the Xt Initialize.c file of | |
36 ;; Release 4. | |
37 | |
38 ;; Command line Resource Manager string | |
39 | |
40 ;; +rv *reverseVideo | |
41 ;; +synchronous *synchronous | |
42 ;; -background *background | |
43 ;; -bd *borderColor | |
44 ;; -bg *background | |
45 ;; -bordercolor *borderColor | |
46 ;; -borderwidth .borderWidth | |
47 ;; -bw .borderWidth | |
48 ;; -display .display | |
49 ;; -fg *foreground | |
50 ;; -fn *font | |
51 ;; -font *font | |
52 ;; -foreground *foreground | |
53 ;; -geometry .geometry | |
3070
08003ba2ac71
* x-win.el (command-switch-alist, x-switch-definitions): Treat
Jim Blandy <jimb@redhat.com>
parents:
3068
diff
changeset
|
54 ;; -i .iconType |
08003ba2ac71
* x-win.el (command-switch-alist, x-switch-definitions): Treat
Jim Blandy <jimb@redhat.com>
parents:
3068
diff
changeset
|
55 ;; -itype .iconType |
54 | 56 ;; -iconic .iconic |
57 ;; -name .name | |
58 ;; -reverse *reverseVideo | |
59 ;; -rv *reverseVideo | |
60 ;; -selectionTimeout .selectionTimeout | |
61 ;; -synchronous *synchronous | |
62 ;; -xrm | |
63 | |
64 ;; An alist of X options and the function which handles them. See | |
65 ;; ../startup.el. | |
66 | |
273 | 67 (if (not (eq window-system 'x)) |
4132
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
68 (error "%s: Loading x-win.el but not compiled for X" (invocation-name))) |
273 | 69 |
779 | 70 (require 'frame) |
467 | 71 (require 'mouse) |
1972
b0cde2f5164d
* term/x-win.el: Require `scroll-bar', not `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1954
diff
changeset
|
72 (require 'scroll-bar) |
2718
c91b18333f58
* x-win.el: Since we require faces.el, there's no point in setting
Jim Blandy <jimb@redhat.com>
parents:
2586
diff
changeset
|
73 (require 'faces) |
c91b18333f58
* x-win.el: Since we require faces.el, there's no point in setting
Jim Blandy <jimb@redhat.com>
parents:
2586
diff
changeset
|
74 (require 'select) |
2808 | 75 (require 'menu-bar) |
273 | 76 |
3373
4177a984e5c0
(x-invocation-args): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
3287
diff
changeset
|
77 (defvar x-invocation-args) |
4177a984e5c0
(x-invocation-args): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
3287
diff
changeset
|
78 |
3081
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
79 (defvar x-command-line-resources nil) |
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
80 |
54 | 81 (setq command-switch-alist |
380 | 82 (append '(("-bw" . x-handle-numeric-switch) |
273 | 83 ("-d" . x-handle-display) |
84 ("-display" . x-handle-display) | |
4132
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
85 ("-name" . x-handle-name-rn-switch) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
86 ("-rn" . x-handle-name-rn-switch) |
273 | 87 ("-T" . x-handle-switch) |
88 ("-r" . x-handle-switch) | |
89 ("-rv" . x-handle-switch) | |
90 ("-reverse" . x-handle-switch) | |
91 ("-fn" . x-handle-switch) | |
92 ("-font" . x-handle-switch) | |
3889
2eebd5d36093
* term/x-win.el (command-switch-alist): "-ib" takes a numeric
Jim Blandy <jimb@redhat.com>
parents:
3756
diff
changeset
|
93 ("-ib" . x-handle-numeric-switch) |
273 | 94 ("-g" . x-handle-geometry) |
95 ("-geometry" . x-handle-geometry) | |
96 ("-fg" . x-handle-switch) | |
97 ("-foreground". x-handle-switch) | |
98 ("-bg" . x-handle-switch) | |
99 ("-background". x-handle-switch) | |
100 ("-ms" . x-handle-switch) | |
1547
2754d53edf5d
(command-switch-alist, x-switch-definitions):
Richard M. Stallman <rms@gnu.org>
parents:
1546
diff
changeset
|
101 ("-itype" . x-handle-switch) |
3070
08003ba2ac71
* x-win.el (command-switch-alist, x-switch-definitions): Treat
Jim Blandy <jimb@redhat.com>
parents:
3068
diff
changeset
|
102 ("-i" . x-handle-switch) |
273 | 103 ("-iconic" . x-handle-switch) |
4132
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
104 ("-xrm" . x-handle-xrm-switch) |
273 | 105 ("-cr" . x-handle-switch) |
106 ("-vb" . x-handle-switch) | |
107 ("-hb" . x-handle-switch) | |
108 ("-bd" . x-handle-switch)) | |
54 | 109 command-switch-alist)) |
110 | |
111 (defconst x-switch-definitions | |
112 '(("-name" name) | |
113 ("-T" name) | |
3068
32c1cb0149b3
* x-win.el (x-select-text): New arg PUSH.
Jim Blandy <jimb@redhat.com>
parents:
3036
diff
changeset
|
114 ("-r" reverse t) |
32c1cb0149b3
* x-win.el (x-select-text): New arg PUSH.
Jim Blandy <jimb@redhat.com>
parents:
3036
diff
changeset
|
115 ("-rv" reverse t) |
32c1cb0149b3
* x-win.el (x-select-text): New arg PUSH.
Jim Blandy <jimb@redhat.com>
parents:
3036
diff
changeset
|
116 ("-reverse" reverse t) |
54 | 117 ("-fn" font) |
118 ("-font" font) | |
119 ("-ib" internal-border-width) | |
120 ("-fg" foreground-color) | |
121 ("-foreground" foreground-color) | |
122 ("-bg" background-color) | |
123 ("-background" background-color) | |
124 ("-ms" mouse-color) | |
125 ("-cr" cursor-color) | |
1547
2754d53edf5d
(command-switch-alist, x-switch-definitions):
Richard M. Stallman <rms@gnu.org>
parents:
1546
diff
changeset
|
126 ("-itype" icon-type t) |
3070
08003ba2ac71
* x-win.el (command-switch-alist, x-switch-definitions): Treat
Jim Blandy <jimb@redhat.com>
parents:
3068
diff
changeset
|
127 ("-i" icon-type t) |
3756
ff9679293922
(x-switch-definitions): Fix -iconic.
Richard M. Stallman <rms@gnu.org>
parents:
3493
diff
changeset
|
128 ("-iconic" visibility icon) |
1984
e0c7208bdafa
* term/x-win.el (x-switch-definitons): Use the proper names for
Jim Blandy <jimb@redhat.com>
parents:
1972
diff
changeset
|
129 ("-vb" vertical-scroll-bars t) |
e0c7208bdafa
* term/x-win.el (x-switch-definitons): Use the proper names for
Jim Blandy <jimb@redhat.com>
parents:
1972
diff
changeset
|
130 ("-hb" horizontal-scroll-bars t) |
54 | 131 ("-bd" border-color) |
132 ("-bw" border-width))) | |
133 | |
134 ;; Handler for switches of the form "-switch value" or "-switch". | |
135 (defun x-handle-switch (switch) | |
136 (let ((aelt (assoc switch x-switch-definitions))) | |
137 (if aelt | |
138 (if (nth 2 aelt) | |
779 | 139 (setq default-frame-alist |
54 | 140 (cons (cons (nth 1 aelt) (nth 2 aelt)) |
779 | 141 default-frame-alist)) |
142 (setq default-frame-alist | |
54 | 143 (cons (cons (nth 1 aelt) |
144 (car x-invocation-args)) | |
779 | 145 default-frame-alist) |
54 | 146 x-invocation-args (cdr x-invocation-args)))))) |
147 | |
148 ;; Handler for switches of the form "-switch n" | |
149 (defun x-handle-numeric-switch (switch) | |
150 (let ((aelt (assoc switch x-switch-definitions))) | |
151 (if aelt | |
779 | 152 (setq default-frame-alist |
54 | 153 (cons (cons (nth 1 aelt) |
154 (string-to-int (car x-invocation-args))) | |
779 | 155 default-frame-alist) |
54 | 156 x-invocation-args |
157 (cdr x-invocation-args))))) | |
158 | |
4132
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
159 ;; Handle the -xrm option. |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
160 (defun x-handle-xrm-switch (switch) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
161 (or (consp x-invocation-args) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
162 (error "%s: missing argument to `%s' option" (invocation-name) switch)) |
3081
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
163 (setq x-command-line-resources (car x-invocation-args)) |
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
164 (setq x-invocation-args (cdr x-invocation-args))) |
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
165 |
54 | 166 ;; Handle the geometry option |
167 (defun x-handle-geometry (switch) | |
2367
df7de9403e02
* x-win.el (x-defined-colors): Use x-color-defined-p instead of
Jim Blandy <jimb@redhat.com>
parents:
2366
diff
changeset
|
168 (setq initial-frame-alist |
df7de9403e02
* x-win.el (x-defined-colors): Use x-color-defined-p instead of
Jim Blandy <jimb@redhat.com>
parents:
2366
diff
changeset
|
169 (append initial-frame-alist |
df7de9403e02
* x-win.el (x-defined-colors): Use x-color-defined-p instead of
Jim Blandy <jimb@redhat.com>
parents:
2366
diff
changeset
|
170 (x-parse-geometry (car x-invocation-args))) |
54 | 171 x-invocation-args (cdr x-invocation-args))) |
172 | |
4132
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
173 ;; Handle the -name and -rn options. Set the variable x-resource-name |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
174 ;; to the option's operand; if the switch was `-name', set the name of |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
175 ;; the initial frame, too. |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
176 (defun x-handle-name-rn-switch (switch) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
177 (or (consp x-invocation-args) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
178 (error "%s: missing argument to `%s' option" (invocation-name) switch)) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
179 (setq x-resource-name (car x-invocation-args) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
180 x-invocation-args (cdr x-invocation-args)) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
181 (if (string= switch "-name") |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
182 (setq initial-frame-alist (cons (cons 'name x-resource-name) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
183 initial-frame-alist)))) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
184 |
54 | 185 (defvar x-display-name nil |
779 | 186 "The X display name specifying server and X frame.") |
54 | 187 |
188 (defun x-handle-display (switch) | |
189 (setq x-display-name (car x-invocation-args) | |
190 x-invocation-args (cdr x-invocation-args))) | |
191 | |
192 (defvar x-invocation-args nil) | |
193 | |
321 | 194 (defun x-handle-args (args) |
195 "Here the X-related command line options in ARGS are processed, | |
196 before the user's startup file is loaded. They are copied to | |
197 x-invocation args from which the X-related things are extracted, first | |
198 the switch (e.g., \"-fg\") in the following code, and possible values | |
199 (e.g., \"black\") in the option handler code (e.g., x-handle-switch). | |
200 This returns ARGS with the arguments that have been processed removed." | |
273 | 201 (setq x-invocation-args args |
202 args nil) | |
203 (while x-invocation-args | |
204 (let* ((this-switch (car x-invocation-args)) | |
205 (aelt (assoc this-switch command-switch-alist))) | |
206 (setq x-invocation-args (cdr x-invocation-args)) | |
207 (if aelt | |
208 (funcall (cdr aelt) this-switch) | |
209 (setq args (cons this-switch args))))) | |
210 (setq args (nreverse args))) | |
211 | |
279 | 212 |
54 | 213 |
214 ;; | |
215 ;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them. | |
216 ;; | |
217 | |
218 (defconst x-pointer-X-cursor 0) | |
219 (defconst x-pointer-arrow 2) | |
220 (defconst x-pointer-based-arrow-down 4) | |
221 (defconst x-pointer-based-arrow-up 6) | |
222 (defconst x-pointer-boat 8) | |
223 (defconst x-pointer-bogosity 10) | |
224 (defconst x-pointer-bottom-left-corner 12) | |
225 (defconst x-pointer-bottom-right-corner 14) | |
226 (defconst x-pointer-bottom-side 16) | |
227 (defconst x-pointer-bottom-tee 18) | |
228 (defconst x-pointer-box-spiral 20) | |
229 (defconst x-pointer-center-ptr 22) | |
230 (defconst x-pointer-circle 24) | |
231 (defconst x-pointer-clock 26) | |
232 (defconst x-pointer-coffee-mug 28) | |
233 (defconst x-pointer-cross 30) | |
234 (defconst x-pointer-cross-reverse 32) | |
235 (defconst x-pointer-crosshair 34) | |
236 (defconst x-pointer-diamond-cross 36) | |
237 (defconst x-pointer-dot 38) | |
238 (defconst x-pointer-dotbox 40) | |
239 (defconst x-pointer-double-arrow 42) | |
240 (defconst x-pointer-draft-large 44) | |
241 (defconst x-pointer-draft-small 46) | |
242 (defconst x-pointer-draped-box 48) | |
243 (defconst x-pointer-exchange 50) | |
244 (defconst x-pointer-fleur 52) | |
245 (defconst x-pointer-gobbler 54) | |
246 (defconst x-pointer-gumby 56) | |
247 (defconst x-pointer-hand1 58) | |
248 (defconst x-pointer-hand2 60) | |
249 (defconst x-pointer-heart 62) | |
250 (defconst x-pointer-icon 64) | |
251 (defconst x-pointer-iron-cross 66) | |
252 (defconst x-pointer-left-ptr 68) | |
253 (defconst x-pointer-left-side 70) | |
254 (defconst x-pointer-left-tee 72) | |
255 (defconst x-pointer-leftbutton 74) | |
256 (defconst x-pointer-ll-angle 76) | |
257 (defconst x-pointer-lr-angle 78) | |
258 (defconst x-pointer-man 80) | |
259 (defconst x-pointer-middlebutton 82) | |
260 (defconst x-pointer-mouse 84) | |
261 (defconst x-pointer-pencil 86) | |
262 (defconst x-pointer-pirate 88) | |
263 (defconst x-pointer-plus 90) | |
264 (defconst x-pointer-question-arrow 92) | |
265 (defconst x-pointer-right-ptr 94) | |
266 (defconst x-pointer-right-side 96) | |
267 (defconst x-pointer-right-tee 98) | |
268 (defconst x-pointer-rightbutton 100) | |
269 (defconst x-pointer-rtl-logo 102) | |
270 (defconst x-pointer-sailboat 104) | |
271 (defconst x-pointer-sb-down-arrow 106) | |
272 (defconst x-pointer-sb-h-double-arrow 108) | |
273 (defconst x-pointer-sb-left-arrow 110) | |
274 (defconst x-pointer-sb-right-arrow 112) | |
275 (defconst x-pointer-sb-up-arrow 114) | |
276 (defconst x-pointer-sb-v-double-arrow 116) | |
277 (defconst x-pointer-shuttle 118) | |
278 (defconst x-pointer-sizing 120) | |
279 (defconst x-pointer-spider 122) | |
280 (defconst x-pointer-spraycan 124) | |
281 (defconst x-pointer-star 126) | |
282 (defconst x-pointer-target 128) | |
283 (defconst x-pointer-tcross 130) | |
284 (defconst x-pointer-top-left-arrow 132) | |
285 (defconst x-pointer-top-left-corner 134) | |
286 (defconst x-pointer-top-right-corner 136) | |
287 (defconst x-pointer-top-side 138) | |
288 (defconst x-pointer-top-tee 140) | |
289 (defconst x-pointer-trek 142) | |
290 (defconst x-pointer-ul-angle 144) | |
291 (defconst x-pointer-umbrella 146) | |
292 (defconst x-pointer-ur-angle 148) | |
293 (defconst x-pointer-watch 150) | |
294 (defconst x-pointer-xterm 152) | |
295 | |
296 ;; | |
297 ;; Available colors | |
298 ;; | |
299 | |
300 (defvar x-colors '("aquamarine" | |
301 "Aquamarine" | |
302 "medium aquamarine" | |
303 "MediumAquamarine" | |
304 "black" | |
305 "Black" | |
306 "blue" | |
307 "Blue" | |
308 "cadet blue" | |
309 "CadetBlue" | |
310 "cornflower blue" | |
311 "CornflowerBlue" | |
312 "dark slate blue" | |
313 "DarkSlateBlue" | |
314 "light blue" | |
315 "LightBlue" | |
316 "light steel blue" | |
317 "LightSteelBlue" | |
318 "medium blue" | |
319 "MediumBlue" | |
320 "medium slate blue" | |
321 "MediumSlateBlue" | |
322 "midnight blue" | |
323 "MidnightBlue" | |
324 "navy blue" | |
325 "NavyBlue" | |
326 "navy" | |
327 "Navy" | |
328 "sky blue" | |
329 "SkyBlue" | |
330 "slate blue" | |
331 "SlateBlue" | |
332 "steel blue" | |
333 "SteelBlue" | |
334 "coral" | |
335 "Coral" | |
336 "cyan" | |
337 "Cyan" | |
338 "firebrick" | |
339 "Firebrick" | |
340 "brown" | |
341 "Brown" | |
342 "gold" | |
343 "Gold" | |
344 "goldenrod" | |
345 "Goldenrod" | |
346 "medium goldenrod" | |
347 "MediumGoldenrod" | |
348 "green" | |
349 "Green" | |
350 "dark green" | |
351 "DarkGreen" | |
352 "dark olive green" | |
353 "DarkOliveGreen" | |
354 "forest green" | |
355 "ForestGreen" | |
356 "lime green" | |
357 "LimeGreen" | |
358 "medium forest green" | |
359 "MediumForestGreen" | |
360 "medium sea green" | |
361 "MediumSeaGreen" | |
362 "medium spring green" | |
363 "MediumSpringGreen" | |
364 "pale green" | |
365 "PaleGreen" | |
366 "sea green" | |
367 "SeaGreen" | |
368 "spring green" | |
369 "SpringGreen" | |
370 "yellow green" | |
371 "YellowGreen" | |
372 "dark slate grey" | |
373 "DarkSlateGrey" | |
374 "dark slate gray" | |
375 "DarkSlateGray" | |
376 "dim grey" | |
377 "DimGrey" | |
378 "dim gray" | |
379 "DimGray" | |
380 "light grey" | |
381 "LightGrey" | |
382 "light gray" | |
383 "LightGray" | |
384 "gray" | |
385 "grey" | |
386 "Gray" | |
387 "Grey" | |
388 "khaki" | |
389 "Khaki" | |
390 "magenta" | |
391 "Magenta" | |
392 "maroon" | |
393 "Maroon" | |
394 "orange" | |
395 "Orange" | |
396 "orchid" | |
397 "Orchid" | |
398 "dark orchid" | |
399 "DarkOrchid" | |
400 "medium orchid" | |
401 "MediumOrchid" | |
402 "pink" | |
403 "Pink" | |
404 "plum" | |
405 "Plum" | |
406 "red" | |
407 "Red" | |
408 "indian red" | |
409 "IndianRed" | |
410 "medium violet red" | |
411 "MediumVioletRed" | |
412 "orange red" | |
413 "OrangeRed" | |
414 "violet red" | |
415 "VioletRed" | |
416 "salmon" | |
417 "Salmon" | |
418 "sienna" | |
419 "Sienna" | |
420 "tan" | |
421 "Tan" | |
422 "thistle" | |
423 "Thistle" | |
424 "turquoise" | |
425 "Turquoise" | |
426 "dark turquoise" | |
427 "DarkTurquoise" | |
428 "medium turquoise" | |
429 "MediumTurquoise" | |
430 "violet" | |
431 "Violet" | |
432 "blue violet" | |
433 "BlueViolet" | |
434 "wheat" | |
435 "Wheat" | |
436 "white" | |
437 "White" | |
438 "yellow" | |
439 "Yellow" | |
440 "green yellow" | |
441 "GreenYellow") | |
442 "The full list of X colors from the rgb.text file.") | |
443 | |
444 (defun x-defined-colors () | |
445 "Return a list of colors supported by the current X-Display." | |
446 (let ((all-colors x-colors) | |
447 (this-color nil) | |
448 (defined-colors nil)) | |
449 (while all-colors | |
450 (setq this-color (car all-colors) | |
451 all-colors (cdr all-colors)) | |
2367
df7de9403e02
* x-win.el (x-defined-colors): Use x-color-defined-p instead of
Jim Blandy <jimb@redhat.com>
parents:
2366
diff
changeset
|
452 (and (x-color-defined-p this-color) |
54 | 453 (setq defined-colors (cons this-color defined-colors)))) |
454 defined-colors)) | |
396 | 455 |
456 ;;;; Function keys | |
457 | |
2586
7fe45a326a98
(global-map): Dyke out the last two event-to-function bindings. These belong
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2563
diff
changeset
|
458 (substitute-key-definition 'suspend-emacs 'iconify-frame global-map) |
1546 | 459 |
2145
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
460 ;; Map certain keypad keys into ASCII characters |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
461 ;; that people usually expect. |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
462 (define-key function-key-map [backspace] [127]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
463 (define-key function-key-map [delete] [127]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
464 (define-key function-key-map [tab] [?\t]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
465 (define-key function-key-map [linefeed] [?\n]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
466 (define-key function-key-map [clear] [11]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
467 (define-key function-key-map [return] [13]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
468 (define-key function-key-map [escape] [?\e]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
469 (define-key function-key-map [M-backspace] [?\M-\d]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
470 (define-key function-key-map [M-delete] [?\M-\d]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
471 (define-key function-key-map [M-tab] [?\M-\t]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
472 (define-key function-key-map [M-linefeed] [?\M-\n]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
473 (define-key function-key-map [M-clear] [?\M-\013]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
474 (define-key function-key-map [M-return] [?\M-\015]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
475 (define-key function-key-map [M-escape] [?\M-\e]) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
476 |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
477 ;; These tell read-char how to convert |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
478 ;; these special chars to ASCII. |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
479 (put 'backspace 'ascii-character 127) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
480 (put 'delete 'ascii-character 127) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
481 (put 'tab 'ascii-character ?\t) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
482 (put 'linefeed 'ascii-character ?\n) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
483 (put 'clear 'ascii-character 12) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
484 (put 'return 'ascii-character 13) |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
485 (put 'escape 'ascii-character ?\e) |
54 | 486 |
1546 | 487 ;;;; Selections and cut buffers |
707 | 488 |
727 | 489 ;;; We keep track of the last text selected here, so we can check the |
490 ;;; current selection against it, and avoid passing back our own text | |
491 ;;; from x-cut-buffer-or-selection-value. | |
492 (defvar x-last-selected-text nil) | |
493 | |
4246
af9d2ade78ed
(x-select-text): Always set the cut buffer,
Richard M. Stallman <rms@gnu.org>
parents:
4236
diff
changeset
|
494 ;;; It is said that overlarge strings are slow to put into the cut buffer, |
af9d2ade78ed
(x-select-text): Always set the cut buffer,
Richard M. Stallman <rms@gnu.org>
parents:
4236
diff
changeset
|
495 ;;; and would crash the clipboard. |
4236
8e14db210975
(x-select-text): Limit size of text sent to cut buffer.
Richard M. Stallman <rms@gnu.org>
parents:
4132
diff
changeset
|
496 (defvar x-cut-buffer-max 20000 |
4246
af9d2ade78ed
(x-select-text): Always set the cut buffer,
Richard M. Stallman <rms@gnu.org>
parents:
4236
diff
changeset
|
497 "Max number of characters to put in the cut buffer or clipboard.") |
4236
8e14db210975
(x-select-text): Limit size of text sent to cut buffer.
Richard M. Stallman <rms@gnu.org>
parents:
4132
diff
changeset
|
498 |
707 | 499 ;;; Make TEXT, a string, the primary and clipboard X selections. |
500 ;;; If you are running xclipboard, this means you can effectively | |
501 ;;; have a window on a copy of the kill-ring. | |
502 ;;; Also, set the value of X cut buffer 0, for backward compatibility | |
1817
5c2bdeb13f68
x-selection-value has been renamed to x-selection.
Jim Blandy <jimb@redhat.com>
parents:
1772
diff
changeset
|
503 ;;; with older X applications. |
3036
98f500ca5593
(x-select-text): New arg PUSH.
Richard M. Stallman <rms@gnu.org>
parents:
2808
diff
changeset
|
504 (defun x-select-text (text &optional push) |
4236
8e14db210975
(x-select-text): Limit size of text sent to cut buffer.
Richard M. Stallman <rms@gnu.org>
parents:
4132
diff
changeset
|
505 ;; Don't send the cut buffer too much text. |
8e14db210975
(x-select-text): Limit size of text sent to cut buffer.
Richard M. Stallman <rms@gnu.org>
parents:
4132
diff
changeset
|
506 ;; It becomes slow, and if really big it causes errors. |
8e14db210975
(x-select-text): Limit size of text sent to cut buffer.
Richard M. Stallman <rms@gnu.org>
parents:
4132
diff
changeset
|
507 (if (< (length text) x-cut-buffer-max) |
4246
af9d2ade78ed
(x-select-text): Always set the cut buffer,
Richard M. Stallman <rms@gnu.org>
parents:
4236
diff
changeset
|
508 (progn |
af9d2ade78ed
(x-select-text): Always set the cut buffer,
Richard M. Stallman <rms@gnu.org>
parents:
4236
diff
changeset
|
509 (x-set-cut-buffer text push) |
af9d2ade78ed
(x-select-text): Always set the cut buffer,
Richard M. Stallman <rms@gnu.org>
parents:
4236
diff
changeset
|
510 (x-set-selection 'CLIPBOARD text)) |
af9d2ade78ed
(x-select-text): Always set the cut buffer,
Richard M. Stallman <rms@gnu.org>
parents:
4236
diff
changeset
|
511 (x-set-cut-buffer "" push)) |
2366
ed9b74c46fb9
* x-win.el: Update copyright to 1993.
Jim Blandy <jimb@redhat.com>
parents:
2157
diff
changeset
|
512 (x-set-selection 'PRIMARY text) |
727 | 513 (setq x-last-selected-text text)) |
643 | 514 |
707 | 515 ;;; Return the value of the current X selection. For compatibility |
516 ;;; with older X applications, this checks cut buffer 0 before | |
517 ;;; retrieving the value of the primary selection. | |
518 (defun x-cut-buffer-or-selection-value () | |
1266 | 519 (let (text) |
520 | |
521 ;; Consult the cut buffer, then the selection. Treat empty strings | |
522 ;; as if they were unset. | |
523 (setq text (x-get-cut-buffer 0)) | |
524 (if (string= text "") (setq text nil)) | |
2366
ed9b74c46fb9
* x-win.el: Update copyright to 1993.
Jim Blandy <jimb@redhat.com>
parents:
2157
diff
changeset
|
525 (or text (setq text (x-get-selection 'PRIMARY))) |
1266 | 526 (if (string= text "") (setq text nil)) |
527 | |
528 (cond | |
529 ((not text) nil) | |
530 ((eq text x-last-selected-text) nil) | |
531 ((string= text x-last-selected-text) | |
532 ;; Record the newer string, so subsequent calls can use the `eq' test. | |
533 (setq x-last-selected-text text) | |
534 nil) | |
535 (t | |
536 (setq x-last-selected-text text))))) | |
707 | 537 |
1546 | 538 |
539 ;;; Do the actual X Windows setup here; the above code just defines | |
540 ;;; functions and variables that we use now. | |
541 | |
542 (setq command-line-args (x-handle-args command-line-args)) | |
4132
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
543 |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
544 ;;; Make sure we have a valid resource name. |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
545 (or (stringp x-resource-name) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
546 (let (i) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
547 (setq x-resource-name (invocation-name)) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
548 |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
549 ;; Change any . or * characters in x-resource-name to hyphens, |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
550 ;; so as not to choke when we use it in X resource queries. |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
551 (while (setq i (string-match "[.*]" x-resource-name)) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
552 (aset x-resource-name i ?-)))) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
553 |
1546 | 554 (x-open-connection (or x-display-name |
3081
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
555 (setq x-display-name (getenv "DISPLAY"))) |
63c51f1e885b
Pass x-command-line-resources to x-open-connection.
Richard M. Stallman <rms@gnu.org>
parents:
3070
diff
changeset
|
556 x-command-line-resources) |
1546 | 557 |
2718
c91b18333f58
* x-win.el: Since we require faces.el, there's no point in setting
Jim Blandy <jimb@redhat.com>
parents:
2586
diff
changeset
|
558 (setq frame-creation-function 'x-create-frame-with-faces) |
2145
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
559 |
3172
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
560 ;; Apply a geometry resource to the initial frame. Put it at the end |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
561 ;; of the alist, so that anything specified on the command line takes |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
562 ;; precedence. |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
563 (let ((res-geometry (x-get-resource "geometry" "Geometry"))) |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
564 (if res-geometry |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
565 (setq initial-frame-alist (append initial-frame-alist |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
566 (x-parse-geometry res-geometry))))) |
2a484b449183
* x-win.el: Check for a geometry resource, and apply it to the
Jim Blandy <jimb@redhat.com>
parents:
3081
diff
changeset
|
567 |
3966
dcf86f82f2c8
* term/x-win.el: Check the reverseVideo/ReverseVideo resource,
Jim Blandy <jimb@redhat.com>
parents:
3889
diff
changeset
|
568 ;; Check the reverseVideo resource. |
4132
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
569 (let ((case-fold-search t)) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
570 (let ((rv (x-get-resource "reverseVideo" "ReverseVideo"))) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
571 (if (and rv |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
572 (string-match "^\\(true\\|yes\\|on\\)$" rv)) |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
573 (setq default-frame-alist |
e0345afdf64e
* term/x-win.el: Include (invocation-name) in the error messages
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
574 (cons '(reverse . t) default-frame-alist))))) |
3966
dcf86f82f2c8
* term/x-win.el: Check the reverseVideo/ReverseVideo resource,
Jim Blandy <jimb@redhat.com>
parents:
3889
diff
changeset
|
575 |
3493
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
576 ;; Set x-selection-timeout, measured in milliseconds. |
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
577 (let ((res-selection-timeout |
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
578 (x-get-resource "selectionTimeout" "SelectionTimeout"))) |
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
579 (setq x-selection-timeout 5000) |
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
580 (if res-selection-timeout |
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
581 (setq x-selection-timeout (string-to-number res-selection-timeout)))) |
b37b09c0b43d
(x-selection-timeout): Set it, using x-get-resource.
Richard M. Stallman <rms@gnu.org>
parents:
3373
diff
changeset
|
582 |
2145
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
583 (defun x-win-suspend-error () |
aa0b19850348
Cancel previous change, since it discarded
Richard M. Stallman <rms@gnu.org>
parents:
2143
diff
changeset
|
584 (error "Suspending an emacs running under X makes no sense")) |
2366
ed9b74c46fb9
* x-win.el: Update copyright to 1993.
Jim Blandy <jimb@redhat.com>
parents:
2157
diff
changeset
|
585 (add-hook 'suspend-hook 'x-win-suspend-error) |
ed9b74c46fb9
* x-win.el: Update copyright to 1993.
Jim Blandy <jimb@redhat.com>
parents:
2157
diff
changeset
|
586 |
707 | 587 ;;; Arrange for the kill and yank functions to set and check the clipboard. |
588 (setq interprogram-cut-function 'x-select-text) | |
589 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value) | |
273 | 590 |
383 | 591 ;;; Turn off window-splitting optimization; X is usually fast enough |
592 ;;; that this is only annoying. | |
593 (setq split-window-keep-point t) | |
2157
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
594 |
0d77768bf3f2
Added library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2145
diff
changeset
|
595 ;;; x-win.el ends here |