]> code.delx.au - gnu-emacs/blob - lisp/term/x-win.el
Fix typo.
[gnu-emacs] / lisp / term / x-win.el
1 ;;; x-win.el --- parse switches controlling interface with X window system
2
3 ;; Copyright (C) 1993, 1994, 2001, 2002 Free Software Foundation, Inc.
4
5 ;; Author: FSF
6 ;; Keywords: terminals
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Commentary:
26
27 ;; X-win.el: this file is loaded from ../lisp/startup.el when it recognizes
28 ;; that X windows are to be used. Command line switches are parsed and those
29 ;; pertaining to X are processed and removed from the command line. The
30 ;; X display is opened and hooks are set for popping up the initial window.
31
32 ;; startup.el will then examine startup files, and eventually call the hooks
33 ;; which create the first window (s).
34
35 ;;; Code:
36 \f
37 ;; These are the standard X switches from the Xt Initialize.c file of
38 ;; Release 4.
39
40 ;; Command line Resource Manager string
41
42 ;; +rv *reverseVideo
43 ;; +synchronous *synchronous
44 ;; -background *background
45 ;; -bd *borderColor
46 ;; -bg *background
47 ;; -bordercolor *borderColor
48 ;; -borderwidth .borderWidth
49 ;; -bw .borderWidth
50 ;; -display .display
51 ;; -fg *foreground
52 ;; -fn *font
53 ;; -font *font
54 ;; -foreground *foreground
55 ;; -geometry .geometry
56 ;; -i .iconType
57 ;; -itype .iconType
58 ;; -iconic .iconic
59 ;; -name .name
60 ;; -reverse *reverseVideo
61 ;; -rv *reverseVideo
62 ;; -selectionTimeout .selectionTimeout
63 ;; -synchronous *synchronous
64 ;; -xrm
65
66 ;; An alist of X options and the function which handles them. See
67 ;; ../startup.el.
68
69 (if (not (eq window-system 'x))
70 (error "%s: Loading x-win.el but not compiled for X" (invocation-name)))
71
72 (require 'frame)
73 (require 'mouse)
74 (require 'scroll-bar)
75 (require 'faces)
76 (require 'select)
77 (require 'menu-bar)
78 (if (fboundp 'new-fontset)
79 (require 'fontset))
80
81 (defvar x-invocation-args)
82
83 (defvar x-command-line-resources nil)
84
85 ;; Handler for switches of the form "-switch value" or "-switch".
86 (defun x-handle-switch (switch)
87 (let ((aelt (assoc switch command-line-x-option-alist)))
88 (if aelt
89 (let ((param (nth 3 aelt))
90 (value (nth 4 aelt)))
91 (if value
92 (setq default-frame-alist
93 (cons (cons param value)
94 default-frame-alist))
95 (setq default-frame-alist
96 (cons (cons param
97 (car x-invocation-args))
98 default-frame-alist)
99 x-invocation-args (cdr x-invocation-args)))))))
100
101 ;; Handler for switches of the form "-switch n"
102 (defun x-handle-numeric-switch (switch)
103 (let ((aelt (assoc switch command-line-x-option-alist)))
104 (if aelt
105 (let ((param (nth 3 aelt)))
106 (setq default-frame-alist
107 (cons (cons param
108 (string-to-int (car x-invocation-args)))
109 default-frame-alist)
110 x-invocation-args
111 (cdr x-invocation-args))))))
112
113 ;; Handle options that apply to initial frame only
114 (defun x-handle-initial-switch (switch)
115 (let ((aelt (assoc switch command-line-x-option-alist)))
116 (if aelt
117 (let ((param (nth 3 aelt))
118 (value (nth 4 aelt)))
119 (if value
120 (setq initial-frame-alist
121 (cons (cons param value)
122 initial-frame-alist))
123 (setq initial-frame-alist
124 (cons (cons param
125 (car x-invocation-args))
126 initial-frame-alist)
127 x-invocation-args (cdr x-invocation-args)))))))
128
129 ;; Make -iconic apply only to the initial frame!
130 (defun x-handle-iconic (switch)
131 (setq initial-frame-alist
132 (cons '(visibility . icon) initial-frame-alist)))
133
134 ;; Handle the -xrm option.
135 (defun x-handle-xrm-switch (switch)
136 (unless (consp x-invocation-args)
137 (error "%s: missing argument to `%s' option" (invocation-name) switch))
138 (setq x-command-line-resources
139 (if (null x-command-line-resources)
140 (car x-invocation-args)
141 (concat x-command-line-resources "\n" (car x-invocation-args))))
142 (setq x-invocation-args (cdr x-invocation-args)))
143
144 ;; Handle the geometry option
145 (defun x-handle-geometry (switch)
146 (let* ((geo (x-parse-geometry (car x-invocation-args)))
147 (left (assq 'left geo))
148 (top (assq 'top geo))
149 (height (assq 'height geo))
150 (width (assq 'width geo)))
151 (if (or height width)
152 (setq default-frame-alist
153 (append default-frame-alist
154 '((user-size . t))
155 (if height (list height))
156 (if width (list width)))
157 initial-frame-alist
158 (append initial-frame-alist
159 '((user-size . t))
160 (if height (list height))
161 (if width (list width)))))
162 (if (or left top)
163 (setq initial-frame-alist
164 (append initial-frame-alist
165 '((user-position . t))
166 (if left (list left))
167 (if top (list top)))))
168 (setq x-invocation-args (cdr x-invocation-args))))
169
170 ;; Handle the -name option. Set the variable x-resource-name
171 ;; to the option's operand; set the name of
172 ;; the initial frame, too.
173 (defun x-handle-name-switch (switch)
174 (or (consp x-invocation-args)
175 (error "%s: missing argument to `%s' option" (invocation-name) switch))
176 (setq x-resource-name (car x-invocation-args)
177 x-invocation-args (cdr x-invocation-args))
178 (setq initial-frame-alist (cons (cons 'name x-resource-name)
179 initial-frame-alist)))
180
181 (defvar x-display-name nil
182 "The X display name specifying server and X frame.")
183
184 (defun x-handle-display (switch)
185 (setq x-display-name (car x-invocation-args)
186 x-invocation-args (cdr x-invocation-args))
187 ;; Make subshell programs see the same DISPLAY value Emacs really uses.
188 ;; Note that this isn't completely correct, since Emacs can use
189 ;; multiple displays. However, there is no way to tell an already
190 ;; running subshell which display the user is currently typing on.
191 (setenv "DISPLAY" x-display-name))
192
193 (defun x-handle-args (args)
194 "Process the X-related command line options in ARGS.
195 This is done before the user's startup file is loaded. They are copied to
196 `x-invocation-args', from which the X-related things are extracted, first
197 the switch (e.g., \"-fg\") in the following code, and possible values
198 \(e.g., \"black\") in the option handler code (e.g., x-handle-switch).
199 This function returns ARGS minus the arguments that have been processed."
200 ;; We use ARGS to accumulate the args that we don't handle here, to return.
201 (setq x-invocation-args args
202 args nil)
203 (while (and x-invocation-args
204 (not (equal (car x-invocation-args) "--")))
205 (let* ((this-switch (car x-invocation-args))
206 (orig-this-switch this-switch)
207 completion argval aelt handler)
208 (setq x-invocation-args (cdr x-invocation-args))
209 ;; Check for long options with attached arguments
210 ;; and separate out the attached option argument into argval.
211 (if (string-match "^--[^=]*=" this-switch)
212 (setq argval (substring this-switch (match-end 0))
213 this-switch (substring this-switch 0 (1- (match-end 0)))))
214 ;; Complete names of long options.
215 (if (string-match "^--" this-switch)
216 (progn
217 (setq completion (try-completion this-switch command-line-x-option-alist))
218 (if (eq completion t)
219 ;; Exact match for long option.
220 nil
221 (if (stringp completion)
222 (let ((elt (assoc completion command-line-x-option-alist)))
223 ;; Check for abbreviated long option.
224 (or elt
225 (error "Option `%s' is ambiguous" this-switch))
226 (setq this-switch completion))))))
227 (setq aelt (assoc this-switch command-line-x-option-alist))
228 (if aelt (setq handler (nth 2 aelt)))
229 (if handler
230 (if argval
231 (let ((x-invocation-args
232 (cons argval x-invocation-args)))
233 (funcall handler this-switch))
234 (funcall handler this-switch))
235 (setq args (cons orig-this-switch args)))))
236 (nconc (nreverse args) x-invocation-args))
237
238 ;; Handle the --smid switch. This is used by the session manager
239 ;; to give us back our session id we had on the previous run.
240 (defun x-handle-smid (switch)
241 (or (consp x-invocation-args)
242 (error "%s: missing argument to `%s' option" (invocation-name) switch))
243 (setq x-session-previous-id (car x-invocation-args)
244 x-invocation-args (cdr x-invocation-args)))
245
246 (defvar emacs-save-session-functions nil
247 "Functions to run when a save-session event occurs.
248 The functions does not get any argument.
249 Functions can return non-nil to inform the session manager that the
250 window system shutdown should be aborted.
251
252 See also `emacs-session-save'.")
253
254 (defun emacs-session-filename (session-id)
255 "Construct a filename to save the session in based on SESSION-ID.
256 If the directory ~/.emacs.d exists, we make a filename in there, otherwise
257 a file in the home directory."
258 (let ((basename (concat "session." session-id))
259 (emacs-dir "~/.emacs.d/"))
260 (expand-file-name (if (file-directory-p emacs-dir)
261 (concat emacs-dir basename)
262 (concat "~/.emacs-" basename)))))
263
264 (defun emacs-session-save ()
265 "This function is called when the window system is shutting down.
266 If this function returns non-nil, the window system shutdown is cancelled.
267
268 When a session manager tells Emacs that the window system is shutting
269 down, this function is called. It calls the functions in the hook
270 `emacs-save-session-functions'. Functions are called with the current
271 buffer set to a temporary buffer. Functions should use `insert' to insert
272 lisp code to save the session state. The buffer is saved
273 in a file in the home directory of the user running Emacs. The file
274 is evaluated when Emacs is restarted by the session manager.
275
276 If any of the functions returns non-nil, no more functions are called
277 and this function returns non-nil. This will inform the session manager
278 that it should abort the window system shutdown."
279 (let ((filename (emacs-session-filename x-session-id))
280 (buf (get-buffer-create (concat " *SES " x-session-id))))
281 (when (file-exists-p filename)
282 (delete-file filename))
283 (with-current-buffer buf
284 (let ((cancel-shutdown (condition-case nil
285 ;; A return of t means cancel the shutdown.
286 (run-hook-with-args-until-success
287 'emacs-save-session-functions)
288 (error t))))
289 (unless cancel-shutdown
290 (write-file filename))
291 (kill-buffer buf)
292 cancel-shutdown))))
293
294 (defun emacs-session-restore (previous-session-id)
295 "Restore the Emacs session if started by a session manager.
296 The file saved by `emacs-session-save' is evaluated and deleted if it
297 exists."
298 (let ((filename (emacs-session-filename previous-session-id)))
299 (when (file-exists-p filename)
300 (load-file filename)
301 (delete-file filename)
302 (message "Restored session data"))))
303
304
305
306 \f
307 ;;
308 ;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them.
309 ;;
310
311 (defconst x-pointer-X-cursor 0)
312 (defconst x-pointer-arrow 2)
313 (defconst x-pointer-based-arrow-down 4)
314 (defconst x-pointer-based-arrow-up 6)
315 (defconst x-pointer-boat 8)
316 (defconst x-pointer-bogosity 10)
317 (defconst x-pointer-bottom-left-corner 12)
318 (defconst x-pointer-bottom-right-corner 14)
319 (defconst x-pointer-bottom-side 16)
320 (defconst x-pointer-bottom-tee 18)
321 (defconst x-pointer-box-spiral 20)
322 (defconst x-pointer-center-ptr 22)
323 (defconst x-pointer-circle 24)
324 (defconst x-pointer-clock 26)
325 (defconst x-pointer-coffee-mug 28)
326 (defconst x-pointer-cross 30)
327 (defconst x-pointer-cross-reverse 32)
328 (defconst x-pointer-crosshair 34)
329 (defconst x-pointer-diamond-cross 36)
330 (defconst x-pointer-dot 38)
331 (defconst x-pointer-dotbox 40)
332 (defconst x-pointer-double-arrow 42)
333 (defconst x-pointer-draft-large 44)
334 (defconst x-pointer-draft-small 46)
335 (defconst x-pointer-draped-box 48)
336 (defconst x-pointer-exchange 50)
337 (defconst x-pointer-fleur 52)
338 (defconst x-pointer-gobbler 54)
339 (defconst x-pointer-gumby 56)
340 (defconst x-pointer-hand1 58)
341 (defconst x-pointer-hand2 60)
342 (defconst x-pointer-heart 62)
343 (defconst x-pointer-icon 64)
344 (defconst x-pointer-iron-cross 66)
345 (defconst x-pointer-left-ptr 68)
346 (defconst x-pointer-left-side 70)
347 (defconst x-pointer-left-tee 72)
348 (defconst x-pointer-leftbutton 74)
349 (defconst x-pointer-ll-angle 76)
350 (defconst x-pointer-lr-angle 78)
351 (defconst x-pointer-man 80)
352 (defconst x-pointer-middlebutton 82)
353 (defconst x-pointer-mouse 84)
354 (defconst x-pointer-pencil 86)
355 (defconst x-pointer-pirate 88)
356 (defconst x-pointer-plus 90)
357 (defconst x-pointer-question-arrow 92)
358 (defconst x-pointer-right-ptr 94)
359 (defconst x-pointer-right-side 96)
360 (defconst x-pointer-right-tee 98)
361 (defconst x-pointer-rightbutton 100)
362 (defconst x-pointer-rtl-logo 102)
363 (defconst x-pointer-sailboat 104)
364 (defconst x-pointer-sb-down-arrow 106)
365 (defconst x-pointer-sb-h-double-arrow 108)
366 (defconst x-pointer-sb-left-arrow 110)
367 (defconst x-pointer-sb-right-arrow 112)
368 (defconst x-pointer-sb-up-arrow 114)
369 (defconst x-pointer-sb-v-double-arrow 116)
370 (defconst x-pointer-shuttle 118)
371 (defconst x-pointer-sizing 120)
372 (defconst x-pointer-spider 122)
373 (defconst x-pointer-spraycan 124)
374 (defconst x-pointer-star 126)
375 (defconst x-pointer-target 128)
376 (defconst x-pointer-tcross 130)
377 (defconst x-pointer-top-left-arrow 132)
378 (defconst x-pointer-top-left-corner 134)
379 (defconst x-pointer-top-right-corner 136)
380 (defconst x-pointer-top-side 138)
381 (defconst x-pointer-top-tee 140)
382 (defconst x-pointer-trek 142)
383 (defconst x-pointer-ul-angle 144)
384 (defconst x-pointer-umbrella 146)
385 (defconst x-pointer-ur-angle 148)
386 (defconst x-pointer-watch 150)
387 (defconst x-pointer-xterm 152)
388 \f
389 ;;
390 ;; Available colors
391 ;;
392
393 (defvar x-colors '("LightGreen"
394 "light green"
395 "DarkRed"
396 "dark red"
397 "DarkMagenta"
398 "dark magenta"
399 "DarkCyan"
400 "dark cyan"
401 "DarkBlue"
402 "dark blue"
403 "DarkGray"
404 "dark gray"
405 "DarkGrey"
406 "dark grey"
407 "grey100"
408 "gray100"
409 "grey99"
410 "gray99"
411 "grey98"
412 "gray98"
413 "grey97"
414 "gray97"
415 "grey96"
416 "gray96"
417 "grey95"
418 "gray95"
419 "grey94"
420 "gray94"
421 "grey93"
422 "gray93"
423 "grey92"
424 "gray92"
425 "grey91"
426 "gray91"
427 "grey90"
428 "gray90"
429 "grey89"
430 "gray89"
431 "grey88"
432 "gray88"
433 "grey87"
434 "gray87"
435 "grey86"
436 "gray86"
437 "grey85"
438 "gray85"
439 "grey84"
440 "gray84"
441 "grey83"
442 "gray83"
443 "grey82"
444 "gray82"
445 "grey81"
446 "gray81"
447 "grey80"
448 "gray80"
449 "grey79"
450 "gray79"
451 "grey78"
452 "gray78"
453 "grey77"
454 "gray77"
455 "grey76"
456 "gray76"
457 "grey75"
458 "gray75"
459 "grey74"
460 "gray74"
461 "grey73"
462 "gray73"
463 "grey72"
464 "gray72"
465 "grey71"
466 "gray71"
467 "grey70"
468 "gray70"
469 "grey69"
470 "gray69"
471 "grey68"
472 "gray68"
473 "grey67"
474 "gray67"
475 "grey66"
476 "gray66"
477 "grey65"
478 "gray65"
479 "grey64"
480 "gray64"
481 "grey63"
482 "gray63"
483 "grey62"
484 "gray62"
485 "grey61"
486 "gray61"
487 "grey60"
488 "gray60"
489 "grey59"
490 "gray59"
491 "grey58"
492 "gray58"
493 "grey57"
494 "gray57"
495 "grey56"
496 "gray56"
497 "grey55"
498 "gray55"
499 "grey54"
500 "gray54"
501 "grey53"
502 "gray53"
503 "grey52"
504 "gray52"
505 "grey51"
506 "gray51"
507 "grey50"
508 "gray50"
509 "grey49"
510 "gray49"
511 "grey48"
512 "gray48"
513 "grey47"
514 "gray47"
515 "grey46"
516 "gray46"
517 "grey45"
518 "gray45"
519 "grey44"
520 "gray44"
521 "grey43"
522 "gray43"
523 "grey42"
524 "gray42"
525 "grey41"
526 "gray41"
527 "grey40"
528 "gray40"
529 "grey39"
530 "gray39"
531 "grey38"
532 "gray38"
533 "grey37"
534 "gray37"
535 "grey36"
536 "gray36"
537 "grey35"
538 "gray35"
539 "grey34"
540 "gray34"
541 "grey33"
542 "gray33"
543 "grey32"
544 "gray32"
545 "grey31"
546 "gray31"
547 "grey30"
548 "gray30"
549 "grey29"
550 "gray29"
551 "grey28"
552 "gray28"
553 "grey27"
554 "gray27"
555 "grey26"
556 "gray26"
557 "grey25"
558 "gray25"
559 "grey24"
560 "gray24"
561 "grey23"
562 "gray23"
563 "grey22"
564 "gray22"
565 "grey21"
566 "gray21"
567 "grey20"
568 "gray20"
569 "grey19"
570 "gray19"
571 "grey18"
572 "gray18"
573 "grey17"
574 "gray17"
575 "grey16"
576 "gray16"
577 "grey15"
578 "gray15"
579 "grey14"
580 "gray14"
581 "grey13"
582 "gray13"
583 "grey12"
584 "gray12"
585 "grey11"
586 "gray11"
587 "grey10"
588 "gray10"
589 "grey9"
590 "gray9"
591 "grey8"
592 "gray8"
593 "grey7"
594 "gray7"
595 "grey6"
596 "gray6"
597 "grey5"
598 "gray5"
599 "grey4"
600 "gray4"
601 "grey3"
602 "gray3"
603 "grey2"
604 "gray2"
605 "grey1"
606 "gray1"
607 "grey0"
608 "gray0"
609 "thistle4"
610 "thistle3"
611 "thistle2"
612 "thistle1"
613 "MediumPurple4"
614 "MediumPurple3"
615 "MediumPurple2"
616 "MediumPurple1"
617 "purple4"
618 "purple3"
619 "purple2"
620 "purple1"
621 "DarkOrchid4"
622 "DarkOrchid3"
623 "DarkOrchid2"
624 "DarkOrchid1"
625 "MediumOrchid4"
626 "MediumOrchid3"
627 "MediumOrchid2"
628 "MediumOrchid1"
629 "plum4"
630 "plum3"
631 "plum2"
632 "plum1"
633 "orchid4"
634 "orchid3"
635 "orchid2"
636 "orchid1"
637 "magenta4"
638 "magenta3"
639 "magenta2"
640 "magenta1"
641 "VioletRed4"
642 "VioletRed3"
643 "VioletRed2"
644 "VioletRed1"
645 "maroon4"
646 "maroon3"
647 "maroon2"
648 "maroon1"
649 "PaleVioletRed4"
650 "PaleVioletRed3"
651 "PaleVioletRed2"
652 "PaleVioletRed1"
653 "LightPink4"
654 "LightPink3"
655 "LightPink2"
656 "LightPink1"
657 "pink4"
658 "pink3"
659 "pink2"
660 "pink1"
661 "HotPink4"
662 "HotPink3"
663 "HotPink2"
664 "HotPink1"
665 "DeepPink4"
666 "DeepPink3"
667 "DeepPink2"
668 "DeepPink1"
669 "red4"
670 "red3"
671 "red2"
672 "red1"
673 "OrangeRed4"
674 "OrangeRed3"
675 "OrangeRed2"
676 "OrangeRed1"
677 "tomato4"
678 "tomato3"
679 "tomato2"
680 "tomato1"
681 "coral4"
682 "coral3"
683 "coral2"
684 "coral1"
685 "DarkOrange4"
686 "DarkOrange3"
687 "DarkOrange2"
688 "DarkOrange1"
689 "orange4"
690 "orange3"
691 "orange2"
692 "orange1"
693 "LightSalmon4"
694 "LightSalmon3"
695 "LightSalmon2"
696 "LightSalmon1"
697 "salmon4"
698 "salmon3"
699 "salmon2"
700 "salmon1"
701 "brown4"
702 "brown3"
703 "brown2"
704 "brown1"
705 "firebrick4"
706 "firebrick3"
707 "firebrick2"
708 "firebrick1"
709 "chocolate4"
710 "chocolate3"
711 "chocolate2"
712 "chocolate1"
713 "tan4"
714 "tan3"
715 "tan2"
716 "tan1"
717 "wheat4"
718 "wheat3"
719 "wheat2"
720 "wheat1"
721 "burlywood4"
722 "burlywood3"
723 "burlywood2"
724 "burlywood1"
725 "sienna4"
726 "sienna3"
727 "sienna2"
728 "sienna1"
729 "IndianRed4"
730 "IndianRed3"
731 "IndianRed2"
732 "IndianRed1"
733 "RosyBrown4"
734 "RosyBrown3"
735 "RosyBrown2"
736 "RosyBrown1"
737 "DarkGoldenrod4"
738 "DarkGoldenrod3"
739 "DarkGoldenrod2"
740 "DarkGoldenrod1"
741 "goldenrod4"
742 "goldenrod3"
743 "goldenrod2"
744 "goldenrod1"
745 "gold4"
746 "gold3"
747 "gold2"
748 "gold1"
749 "yellow4"
750 "yellow3"
751 "yellow2"
752 "yellow1"
753 "LightYellow4"
754 "LightYellow3"
755 "LightYellow2"
756 "LightYellow1"
757 "LightGoldenrod4"
758 "LightGoldenrod3"
759 "LightGoldenrod2"
760 "LightGoldenrod1"
761 "khaki4"
762 "khaki3"
763 "khaki2"
764 "khaki1"
765 "DarkOliveGreen4"
766 "DarkOliveGreen3"
767 "DarkOliveGreen2"
768 "DarkOliveGreen1"
769 "OliveDrab4"
770 "OliveDrab3"
771 "OliveDrab2"
772 "OliveDrab1"
773 "chartreuse4"
774 "chartreuse3"
775 "chartreuse2"
776 "chartreuse1"
777 "green4"
778 "green3"
779 "green2"
780 "green1"
781 "SpringGreen4"
782 "SpringGreen3"
783 "SpringGreen2"
784 "SpringGreen1"
785 "PaleGreen4"
786 "PaleGreen3"
787 "PaleGreen2"
788 "PaleGreen1"
789 "SeaGreen4"
790 "SeaGreen3"
791 "SeaGreen2"
792 "SeaGreen1"
793 "DarkSeaGreen4"
794 "DarkSeaGreen3"
795 "DarkSeaGreen2"
796 "DarkSeaGreen1"
797 "aquamarine4"
798 "aquamarine3"
799 "aquamarine2"
800 "aquamarine1"
801 "DarkSlateGray4"
802 "DarkSlateGray3"
803 "DarkSlateGray2"
804 "DarkSlateGray1"
805 "cyan4"
806 "cyan3"
807 "cyan2"
808 "cyan1"
809 "turquoise4"
810 "turquoise3"
811 "turquoise2"
812 "turquoise1"
813 "CadetBlue4"
814 "CadetBlue3"
815 "CadetBlue2"
816 "CadetBlue1"
817 "PaleTurquoise4"
818 "PaleTurquoise3"
819 "PaleTurquoise2"
820 "PaleTurquoise1"
821 "LightCyan4"
822 "LightCyan3"
823 "LightCyan2"
824 "LightCyan1"
825 "LightBlue4"
826 "LightBlue3"
827 "LightBlue2"
828 "LightBlue1"
829 "LightSteelBlue4"
830 "LightSteelBlue3"
831 "LightSteelBlue2"
832 "LightSteelBlue1"
833 "SlateGray4"
834 "SlateGray3"
835 "SlateGray2"
836 "SlateGray1"
837 "LightSkyBlue4"
838 "LightSkyBlue3"
839 "LightSkyBlue2"
840 "LightSkyBlue1"
841 "SkyBlue4"
842 "SkyBlue3"
843 "SkyBlue2"
844 "SkyBlue1"
845 "DeepSkyBlue4"
846 "DeepSkyBlue3"
847 "DeepSkyBlue2"
848 "DeepSkyBlue1"
849 "SteelBlue4"
850 "SteelBlue3"
851 "SteelBlue2"
852 "SteelBlue1"
853 "DodgerBlue4"
854 "DodgerBlue3"
855 "DodgerBlue2"
856 "DodgerBlue1"
857 "blue4"
858 "blue3"
859 "blue2"
860 "blue1"
861 "RoyalBlue4"
862 "RoyalBlue3"
863 "RoyalBlue2"
864 "RoyalBlue1"
865 "SlateBlue4"
866 "SlateBlue3"
867 "SlateBlue2"
868 "SlateBlue1"
869 "azure4"
870 "azure3"
871 "azure2"
872 "azure1"
873 "MistyRose4"
874 "MistyRose3"
875 "MistyRose2"
876 "MistyRose1"
877 "LavenderBlush4"
878 "LavenderBlush3"
879 "LavenderBlush2"
880 "LavenderBlush1"
881 "honeydew4"
882 "honeydew3"
883 "honeydew2"
884 "honeydew1"
885 "ivory4"
886 "ivory3"
887 "ivory2"
888 "ivory1"
889 "cornsilk4"
890 "cornsilk3"
891 "cornsilk2"
892 "cornsilk1"
893 "LemonChiffon4"
894 "LemonChiffon3"
895 "LemonChiffon2"
896 "LemonChiffon1"
897 "NavajoWhite4"
898 "NavajoWhite3"
899 "NavajoWhite2"
900 "NavajoWhite1"
901 "PeachPuff4"
902 "PeachPuff3"
903 "PeachPuff2"
904 "PeachPuff1"
905 "bisque4"
906 "bisque3"
907 "bisque2"
908 "bisque1"
909 "AntiqueWhite4"
910 "AntiqueWhite3"
911 "AntiqueWhite2"
912 "AntiqueWhite1"
913 "seashell4"
914 "seashell3"
915 "seashell2"
916 "seashell1"
917 "snow4"
918 "snow3"
919 "snow2"
920 "snow1"
921 "thistle"
922 "MediumPurple"
923 "medium purple"
924 "purple"
925 "BlueViolet"
926 "blue violet"
927 "DarkViolet"
928 "dark violet"
929 "DarkOrchid"
930 "dark orchid"
931 "MediumOrchid"
932 "medium orchid"
933 "orchid"
934 "plum"
935 "violet"
936 "magenta"
937 "VioletRed"
938 "violet red"
939 "MediumVioletRed"
940 "medium violet red"
941 "maroon"
942 "PaleVioletRed"
943 "pale violet red"
944 "LightPink"
945 "light pink"
946 "pink"
947 "DeepPink"
948 "deep pink"
949 "HotPink"
950 "hot pink"
951 "red"
952 "OrangeRed"
953 "orange red"
954 "tomato"
955 "LightCoral"
956 "light coral"
957 "coral"
958 "DarkOrange"
959 "dark orange"
960 "orange"
961 "LightSalmon"
962 "light salmon"
963 "salmon"
964 "DarkSalmon"
965 "dark salmon"
966 "brown"
967 "firebrick"
968 "chocolate"
969 "tan"
970 "SandyBrown"
971 "sandy brown"
972 "wheat"
973 "beige"
974 "burlywood"
975 "peru"
976 "sienna"
977 "SaddleBrown"
978 "saddle brown"
979 "IndianRed"
980 "indian red"
981 "RosyBrown"
982 "rosy brown"
983 "DarkGoldenrod"
984 "dark goldenrod"
985 "goldenrod"
986 "LightGoldenrod"
987 "light goldenrod"
988 "gold"
989 "yellow"
990 "LightYellow"
991 "light yellow"
992 "LightGoldenrodYellow"
993 "light goldenrod yellow"
994 "PaleGoldenrod"
995 "pale goldenrod"
996 "khaki"
997 "DarkKhaki"
998 "dark khaki"
999 "OliveDrab"
1000 "olive drab"
1001 "ForestGreen"
1002 "forest green"
1003 "YellowGreen"
1004 "yellow green"
1005 "LimeGreen"
1006 "lime green"
1007 "GreenYellow"
1008 "green yellow"
1009 "MediumSpringGreen"
1010 "medium spring green"
1011 "chartreuse"
1012 "green"
1013 "LawnGreen"
1014 "lawn green"
1015 "SpringGreen"
1016 "spring green"
1017 "PaleGreen"
1018 "pale green"
1019 "LightSeaGreen"
1020 "light sea green"
1021 "MediumSeaGreen"
1022 "medium sea green"
1023 "SeaGreen"
1024 "sea green"
1025 "DarkSeaGreen"
1026 "dark sea green"
1027 "DarkOliveGreen"
1028 "dark olive green"
1029 "DarkGreen"
1030 "dark green"
1031 "aquamarine"
1032 "MediumAquamarine"
1033 "medium aquamarine"
1034 "CadetBlue"
1035 "cadet blue"
1036 "LightCyan"
1037 "light cyan"
1038 "cyan"
1039 "turquoise"
1040 "MediumTurquoise"
1041 "medium turquoise"
1042 "DarkTurquoise"
1043 "dark turquoise"
1044 "PaleTurquoise"
1045 "pale turquoise"
1046 "PowderBlue"
1047 "powder blue"
1048 "LightBlue"
1049 "light blue"
1050 "LightSteelBlue"
1051 "light steel blue"
1052 "SteelBlue"
1053 "steel blue"
1054 "LightSkyBlue"
1055 "light sky blue"
1056 "SkyBlue"
1057 "sky blue"
1058 "DeepSkyBlue"
1059 "deep sky blue"
1060 "DodgerBlue"
1061 "dodger blue"
1062 "blue"
1063 "RoyalBlue"
1064 "royal blue"
1065 "MediumBlue"
1066 "medium blue"
1067 "LightSlateBlue"
1068 "light slate blue"
1069 "MediumSlateBlue"
1070 "medium slate blue"
1071 "SlateBlue"
1072 "slate blue"
1073 "DarkSlateBlue"
1074 "dark slate blue"
1075 "CornflowerBlue"
1076 "cornflower blue"
1077 "NavyBlue"
1078 "navy blue"
1079 "navy"
1080 "MidnightBlue"
1081 "midnight blue"
1082 "LightGray"
1083 "light gray"
1084 "LightGrey"
1085 "light grey"
1086 "grey"
1087 "gray"
1088 "LightSlateGrey"
1089 "light slate grey"
1090 "LightSlateGray"
1091 "light slate gray"
1092 "SlateGrey"
1093 "slate grey"
1094 "SlateGray"
1095 "slate gray"
1096 "DimGrey"
1097 "dim grey"
1098 "DimGray"
1099 "dim gray"
1100 "DarkSlateGrey"
1101 "dark slate grey"
1102 "DarkSlateGray"
1103 "dark slate gray"
1104 "black"
1105 "white"
1106 "MistyRose"
1107 "misty rose"
1108 "LavenderBlush"
1109 "lavender blush"
1110 "lavender"
1111 "AliceBlue"
1112 "alice blue"
1113 "azure"
1114 "MintCream"
1115 "mint cream"
1116 "honeydew"
1117 "seashell"
1118 "LemonChiffon"
1119 "lemon chiffon"
1120 "ivory"
1121 "cornsilk"
1122 "moccasin"
1123 "NavajoWhite"
1124 "navajo white"
1125 "PeachPuff"
1126 "peach puff"
1127 "bisque"
1128 "BlanchedAlmond"
1129 "blanched almond"
1130 "PapayaWhip"
1131 "papaya whip"
1132 "AntiqueWhite"
1133 "antique white"
1134 "linen"
1135 "OldLace"
1136 "old lace"
1137 "FloralWhite"
1138 "floral white"
1139 "gainsboro"
1140 "WhiteSmoke"
1141 "white smoke"
1142 "GhostWhite"
1143 "ghost white"
1144 "snow")
1145 "The list of X colors from the `rgb.txt' file.
1146 XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
1147
1148 (defun xw-defined-colors (&optional frame)
1149 "Internal function called by `defined-colors', which see."
1150 (or frame (setq frame (selected-frame)))
1151 (let ((all-colors x-colors)
1152 (this-color nil)
1153 (defined-colors nil))
1154 (while all-colors
1155 (setq this-color (car all-colors)
1156 all-colors (cdr all-colors))
1157 (and (color-supported-p this-color frame t)
1158 (setq defined-colors (cons this-color defined-colors))))
1159 defined-colors))
1160 \f
1161 ;;;; Function keys
1162
1163 (defun iconify-or-deiconify-frame ()
1164 "Iconify the selected frame, or deiconify if it's currently an icon."
1165 (interactive)
1166 (if (eq (cdr (assq 'visibility (frame-parameters))) t)
1167 (iconify-frame)
1168 (make-frame-visible)))
1169
1170 (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
1171 global-map)
1172
1173 ;; Map certain keypad keys into ASCII characters
1174 ;; that people usually expect.
1175 (define-key function-key-map [backspace] [127])
1176 (define-key function-key-map [delete] [127])
1177 (define-key function-key-map [tab] [?\t])
1178 (define-key function-key-map [linefeed] [?\n])
1179 (define-key function-key-map [clear] [?\C-l])
1180 (define-key function-key-map [return] [?\C-m])
1181 (define-key function-key-map [escape] [?\e])
1182 (define-key function-key-map [M-backspace] [?\M-\d])
1183 (define-key function-key-map [M-delete] [?\M-\d])
1184 (define-key function-key-map [M-tab] [?\M-\t])
1185 (define-key function-key-map [M-linefeed] [?\M-\n])
1186 (define-key function-key-map [M-clear] [?\M-\C-l])
1187 (define-key function-key-map [M-return] [?\M-\C-m])
1188 (define-key function-key-map [M-escape] [?\M-\e])
1189 (define-key function-key-map [iso-lefttab] [backtab])
1190
1191 ;; These tell read-char how to convert
1192 ;; these special chars to ASCII.
1193 (put 'backspace 'ascii-character 127)
1194 (put 'delete 'ascii-character 127)
1195 (put 'tab 'ascii-character ?\t)
1196 (put 'linefeed 'ascii-character ?\n)
1197 (put 'clear 'ascii-character 12)
1198 (put 'return 'ascii-character 13)
1199 (put 'escape 'ascii-character ?\e)
1200
1201 (defun vendor-specific-keysyms (vendor)
1202 "Return the appropriate value of system-key-alist for VENDOR.
1203 VENDOR is a string containing the name of the X Server's vendor,
1204 as returned by (x-server-vendor)."
1205 (cond ((string-equal vendor "Apollo Computer Inc.")
1206 '((65280 . linedel)
1207 (65281 . chardel)
1208 (65282 . copy)
1209 (65283 . cut)
1210 (65284 . paste)
1211 (65285 . move)
1212 (65286 . grow)
1213 (65287 . cmd)
1214 (65288 . shell)
1215 (65289 . leftbar)
1216 (65290 . rightbar)
1217 (65291 . leftbox)
1218 (65292 . rightbox)
1219 (65293 . upbox)
1220 (65294 . downbox)
1221 (65295 . pop)
1222 (65296 . read)
1223 (65297 . edit)
1224 (65298 . save)
1225 (65299 . exit)
1226 (65300 . repeat)))
1227 ((or (string-equal vendor "Hewlett-Packard Incorporated")
1228 (string-equal vendor "Hewlett-Packard Company"))
1229 '(( 168 . mute-acute)
1230 ( 169 . mute-grave)
1231 ( 170 . mute-asciicircum)
1232 ( 171 . mute-diaeresis)
1233 ( 172 . mute-asciitilde)
1234 ( 175 . lira)
1235 ( 190 . guilder)
1236 ( 252 . block)
1237 ( 256 . longminus)
1238 (65388 . reset)
1239 (65389 . system)
1240 (65390 . user)
1241 (65391 . clearline)
1242 (65392 . insertline)
1243 (65393 . deleteline)
1244 (65394 . insertchar)
1245 (65395 . deletechar)
1246 (65396 . backtab)
1247 (65397 . kp-backtab)))
1248 ((or (string-equal vendor "X11/NeWS - Sun Microsystems Inc.")
1249 (string-equal vendor "X Consortium"))
1250 '((392976 . f36)
1251 (392977 . f37)
1252 (393056 . req)
1253 ;; These are for Sun under X11R6
1254 (393072 . props)
1255 (393073 . front)
1256 (393074 . copy)
1257 (393075 . open)
1258 (393076 . paste)
1259 (393077 . cut)))
1260 (t
1261 ;; This is used by DEC's X server.
1262 '((65280 . remove)))))
1263
1264 \f
1265 ;;;; Selections and cut buffers
1266
1267 ;;; We keep track of the last text selected here, so we can check the
1268 ;;; current selection against it, and avoid passing back our own text
1269 ;;; from x-cut-buffer-or-selection-value. We track all three
1270 ;;; seperately in case another X application only sets one of them
1271 ;;; (say the cut buffer) we aren't fooled by the PRIMARY or
1272 ;;; CLIPBOARD selection staying the same.
1273 (defvar x-last-selected-text-clipboard nil
1274 "The value of the CLIPBOARD X selection last time we selected or
1275 pasted text.")
1276 (defvar x-last-selected-text-primary nil
1277 "The value of the PRIMARY X selection last time we selected or
1278 pasted text.")
1279 (defvar x-last-selected-text-cut nil
1280 "The vaue of the X cut buffer last time we selected or
1281 pasted text.")
1282
1283 ;;; It is said that overlarge strings are slow to put into the cut buffer.
1284 ;;; Note this value is overridden below.
1285 (defvar x-cut-buffer-max 20000
1286 "Max number of characters to put in the cut buffer.")
1287
1288 (defcustom x-select-enable-clipboard nil
1289 "Non-nil means cutting and pasting uses the clipboard.
1290 This is in addition to, but in preference to, the primary selection."
1291 :type 'boolean
1292 :group 'killing)
1293
1294 ;;; Make TEXT, a string, the primary X selection.
1295 ;;; Also, set the value of X cut buffer 0, for backward compatibility
1296 ;;; with older X applications.
1297 ;;; gildea@stop.mail-abuse.org says it's not desirable to put kills
1298 ;;; in the clipboard.
1299 (defun x-select-text (text &optional push)
1300 ;; Don't send the cut buffer too much text.
1301 ;; It becomes slow, and if really big it causes errors.
1302 (cond ((>= (length text) x-cut-buffer-max)
1303 (x-set-cut-buffer "" push)
1304 (setq x-last-selected-text-cut ""))
1305 (t
1306 (x-set-cut-buffer text push)
1307 (setq x-last-selected-text-cut text)))
1308 (x-set-selection 'PRIMARY text)
1309 (setq x-last-selected-text-primary text)
1310 (when x-select-enable-clipboard
1311 (x-set-selection 'CLIPBOARD text)
1312 (setq x-last-selected-text-clipboard text))
1313 )
1314
1315 ;;; Return the value of the current X selection.
1316 ;;; Consult the selection, and the cut buffer. Treat empty strings
1317 ;;; as if they were unset.
1318 ;;; If this function is called twice and finds the same text,
1319 ;;; it returns nil the second time. This is so that a single
1320 ;;; selection won't be added to the kill ring over and over.
1321 (defun x-cut-buffer-or-selection-value ()
1322 (let (clip-text primary-text cut-text)
1323 (when x-select-enable-clipboard
1324 ;; Don't die if x-get-selection signals an error.
1325 (if (null clip-text)
1326 (condition-case c
1327 (setq clip-text (x-get-selection 'CLIPBOARD 'COMPOUND_TEXT))
1328 (error nil)))
1329 (if (null clip-text)
1330 (condition-case c
1331 (setq clip-text (x-get-selection 'CLIPBOARD 'STRING))
1332 (error nil)))
1333 (if (string= clip-text "") (setq clip-text nil))
1334
1335 ;; Check the CLIPBOARD selection for 'newness', is it different
1336 ;; from what we remebered them to be last time we did a
1337 ;; cut/paste operation.
1338 (setq clip-text
1339 (cond;; check clipboard
1340 ((or (not clip-text) (string= clip-text ""))
1341 (setq x-last-selected-text-clipboard nil))
1342 ((eq clip-text x-last-selected-text-clipboard) nil)
1343 ((string= clip-text x-last-selected-text-clipboard)
1344 ;; Record the newer string,
1345 ;; so subsequent calls can use the `eq' test.
1346 (setq x-last-selected-text-clipboard clip-text)
1347 nil)
1348 (t
1349 (setq x-last-selected-text-clipboard clip-text))))
1350 )
1351
1352 ;; Don't die if x-get-selection signals an error.
1353 (if (null primary-text)
1354 (condition-case c
1355 (setq primary-text (x-get-selection 'PRIMARY 'COMPOUND_TEXT))
1356 (error nil)))
1357 (if (null primary-text)
1358 (condition-case c
1359 (setq primary-text (x-get-selection 'PRIMARY 'STRING))
1360 (error nil)))
1361 ;; Check the PRIMARY selection for 'newness', is it different
1362 ;; from what we remebered them to be last time we did a
1363 ;; cut/paste operation.
1364 (setq primary-text
1365 (cond;; check primary selection
1366 ((or (not primary-text) (string= primary-text ""))
1367 (setq x-last-selected-text-primary nil))
1368 ((eq primary-text x-last-selected-text-primary) nil)
1369 ((string= primary-text x-last-selected-text-primary)
1370 ;; Record the newer string,
1371 ;; so subsequent calls can use the `eq' test.
1372 (setq x-last-selected-text-primary primary-text)
1373 nil)
1374 (t
1375 (setq x-last-selected-text-primary primary-text))))
1376
1377 (setq cut-text (x-get-cut-buffer 0))
1378
1379 ;; Check the x cut buffer for 'newness', is it different
1380 ;; from what we remebered them to be last time we did a
1381 ;; cut/paste operation.
1382 (setq cut-text
1383 (cond;; check primary selection
1384 ((or (not cut-text) (string= cut-text ""))
1385 (setq x-last-selected-text-cut nil))
1386 ((eq cut-text x-last-selected-text-cut) nil)
1387 ((string= cut-text x-last-selected-text-cut)
1388 ;; Record the newer string,
1389 ;; so subsequent calls can use the `eq' test.
1390 (setq x-last-selected-text-cut cut-text)
1391 nil)
1392 (t
1393 (setq x-last-selected-text-cut cut-text))))
1394
1395 ;; At this point we have recorded the current values for the
1396 ;; selection from clipboard (if we are supposed to) primary,
1397 ;; and cut buffer. So return the first one that has changed
1398 ;; (which is the first non-null one).
1399 ;;
1400 ;; NOTE: There will be cases where more than one of these has
1401 ;; changed and the new values differ. This indicates that
1402 ;; something like the following has happened since the last time
1403 ;; we looked at the selections: Application X set all the
1404 ;; selections, then Application Y set only one or two of them (say
1405 ;; just the cut-buffer). In this case since we don't have
1406 ;; timestamps there is no way to know what the 'correct' value to
1407 ;; return is. The nice thing to do would be to tell the user we
1408 ;; saw multiple possible selections and ask the user which was the
1409 ;; one they wanted.
1410 ;; This code is still a big improvement because now the user can
1411 ;; futz with the current selection and get emacs to pay attention
1412 ;; to the cut buffer again (previously as soon as clipboard or
1413 ;; primary had been set the cut buffer would essentially never be
1414 ;; checked again).
1415 (or clip-text primary-text cut-text)
1416 ))
1417
1418 \f
1419 ;;; Do the actual X Windows setup here; the above code just defines
1420 ;;; functions and variables that we use now.
1421
1422 (setq command-line-args (x-handle-args command-line-args))
1423
1424 ;;; Make sure we have a valid resource name.
1425 (or (stringp x-resource-name)
1426 (let (i)
1427 (setq x-resource-name (invocation-name))
1428
1429 ;; Change any . or * characters in x-resource-name to hyphens,
1430 ;; so as not to choke when we use it in X resource queries.
1431 (while (setq i (string-match "[.*]" x-resource-name))
1432 (aset x-resource-name i ?-))))
1433
1434 ;; For the benefit of older Emacses (19.27 and earlier) that are sharing
1435 ;; the same lisp directory, don't pass the third argument unless we seem
1436 ;; to have the multi-display support.
1437 (if (fboundp 'x-close-connection)
1438 (x-open-connection (or x-display-name
1439 (setq x-display-name (getenv "DISPLAY")))
1440 x-command-line-resources
1441 ;; Exit Emacs with fatal error if this fails.
1442 t)
1443 (x-open-connection (or x-display-name
1444 (setq x-display-name (getenv "DISPLAY")))
1445 x-command-line-resources))
1446
1447 (setq frame-creation-function 'x-create-frame-with-faces)
1448
1449 (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
1450 x-cut-buffer-max))
1451
1452 (if (fboundp 'new-fontset)
1453 (progn
1454 ;; Create the standard fontset.
1455 (create-fontset-from-fontset-spec standard-fontset-spec t)
1456
1457 ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...).
1458 (create-fontset-from-x-resource)
1459
1460 ;; Try to create a fontset from a font specification which comes
1461 ;; from initial-frame-alist, default-frame-alist, or X resource.
1462 ;; A font specification in command line argument (i.e. -fn XXXX)
1463 ;; should be already in default-frame-alist as a `font'
1464 ;; parameter. However, any font specifications in site-start
1465 ;; library, user's init file (.emacs), and default.el are not
1466 ;; yet handled here.
1467
1468 (let ((font (or (cdr (assq 'font initial-frame-alist))
1469 (cdr (assq 'font default-frame-alist))
1470 (x-get-resource "font" "Font")))
1471 xlfd-fields resolved-name)
1472 (if (and font
1473 (not (query-fontset font))
1474 (setq resolved-name (x-resolve-font-name font))
1475 (setq xlfd-fields (x-decompose-font-name font)))
1476 (if (string= "fontset"
1477 (aref xlfd-fields xlfd-regexp-registry-subnum))
1478 (new-fontset font (x-complement-fontset-spec xlfd-fields nil))
1479 ;; Create a fontset from FONT. The fontset name is
1480 ;; generated from FONT.
1481 (create-fontset-from-ascii-font font
1482 resolved-name "startup"))))))
1483
1484 ;; Sun expects the menu bar cut and paste commands to use the clipboard.
1485 ;; This has ,? to match both on Sunos and on Solaris.
1486 (if (string-match "Sun Microsystems,? Inc\\."
1487 (x-server-vendor))
1488 (menu-bar-enable-clipboard))
1489
1490 ;; Apply a geometry resource to the initial frame. Put it at the end
1491 ;; of the alist, so that anything specified on the command line takes
1492 ;; precedence.
1493 (let* ((res-geometry (x-get-resource "geometry" "Geometry"))
1494 parsed)
1495 (if res-geometry
1496 (progn
1497 (setq parsed (x-parse-geometry res-geometry))
1498 ;; If the resource specifies a position,
1499 ;; call the position and size "user-specified".
1500 (if (or (assq 'top parsed) (assq 'left parsed))
1501 (setq parsed (cons '(user-position . t)
1502 (cons '(user-size . t) parsed))))
1503 ;; All geometry parms apply to the initial frame.
1504 (setq initial-frame-alist (append initial-frame-alist parsed))
1505 ;; The size parms apply to all frames.
1506 (if (assq 'height parsed)
1507 (setq default-frame-alist
1508 (cons (cons 'height (cdr (assq 'height parsed)))
1509 default-frame-alist)))
1510 (if (assq 'width parsed)
1511 (setq default-frame-alist
1512 (cons (cons 'width (cdr (assq 'width parsed)))
1513 default-frame-alist))))))
1514
1515 ;; Check the reverseVideo resource.
1516 (let ((case-fold-search t))
1517 (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
1518 (if (and rv
1519 (string-match "^\\(true\\|yes\\|on\\)$" rv))
1520 (setq default-frame-alist
1521 (cons '(reverse . t) default-frame-alist)))))
1522
1523 ;; Set x-selection-timeout, measured in milliseconds.
1524 (let ((res-selection-timeout
1525 (x-get-resource "selectionTimeout" "SelectionTimeout")))
1526 (setq x-selection-timeout 20000)
1527 (if res-selection-timeout
1528 (setq x-selection-timeout (string-to-number res-selection-timeout))))
1529
1530 (defun x-win-suspend-error ()
1531 (error "Suspending an emacs running under X makes no sense"))
1532 (add-hook 'suspend-hook 'x-win-suspend-error)
1533
1534 ;;; Arrange for the kill and yank functions to set and check the clipboard.
1535 (setq interprogram-cut-function 'x-select-text)
1536 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
1537
1538 ;;; Turn off window-splitting optimization; X is usually fast enough
1539 ;;; that this is only annoying.
1540 (setq split-window-keep-point t)
1541
1542 ;; Don't show the frame name; that's redundant with X.
1543 (setq-default mode-line-frame-identification " ")
1544
1545 ;;; Motif direct handling of f10 wasn't working right,
1546 ;;; So temporarily we've turned it off in lwlib-Xm.c
1547 ;;; and turned the Emacs f10 back on.
1548 ;;; ;; Motif normally handles f10 itself, so don't try to handle it a second time.
1549 ;;; (if (featurep 'motif)
1550 ;;; (global-set-key [f10] 'ignore))
1551
1552 ;;; x-win.el ends here