Remove extra TAB in Greek entries.
[emacs.git] / lisp / term / w32-win.el
blob565f9a6b5b57e992431a251880f710da266445e2
1 ;;; w32-win.el --- parse switches controlling interface with W32 window system
3 ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
5 ;; Author: Kevin Gallo
6 ;; Keywords: terminals
8 ;; This file is part of GNU Emacs.
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.
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.
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.
25 ;;; Commentary:
27 ;; w32-win.el: this file is loaded from ../lisp/startup.el when it recognizes
28 ;; that W32 windows are to be used. Command line switches are parsed and those
29 ;; pertaining to W32 are processed and removed from the command line. The
30 ;; W32 display is opened and hooks are set for popping up the initial window.
32 ;; startup.el will then examine startup files, and eventually call the hooks
33 ;; which create the first window (s).
35 ;;; Code:
38 ;; These are the standard X switches from the Xt Initialize.c file of
39 ;; Release 4.
41 ;; Command line Resource Manager string
43 ;; +rv *reverseVideo
44 ;; +synchronous *synchronous
45 ;; -background *background
46 ;; -bd *borderColor
47 ;; -bg *background
48 ;; -bordercolor *borderColor
49 ;; -borderwidth .borderWidth
50 ;; -bw .borderWidth
51 ;; -display .display
52 ;; -fg *foreground
53 ;; -fn *font
54 ;; -font *font
55 ;; -foreground *foreground
56 ;; -geometry .geometry
57 ;; -i .iconType
58 ;; -itype .iconType
59 ;; -iconic .iconic
60 ;; -name .name
61 ;; -reverse *reverseVideo
62 ;; -rv *reverseVideo
63 ;; -selectionTimeout .selectionTimeout
64 ;; -synchronous *synchronous
65 ;; -xrm
67 ;; An alist of X options and the function which handles them. See
68 ;; ../startup.el.
70 (if (not (eq window-system 'w32))
71 (error "%s: Loading w32-win.el but not compiled for w32" (invocation-name)))
73 (require 'frame)
74 (require 'mouse)
75 (require 'scroll-bar)
76 (require 'faces)
77 (require 'select)
78 (require 'menu-bar)
79 ;; Conditional on new-fontset so bootstrapping works on non-GUI compiles
80 (if (fboundp 'new-fontset)
81 (require 'fontset))
83 ;; The following definition is used for debugging scroll bar events.
84 ;(defun w32-handle-scroll-bar-event (event) (interactive "e") (princ event))
86 ;; Handle mouse-wheel events with mwheel.
87 ;; Normally only mouse-wheel-mode and mwheel-install are autoloaded,
88 ;; but binding mouse-wheel must be done directly, since those functions
89 ;; do not recognize mouse-wheel as a valid button.
90 (autoload 'mwheel-scroll "mwheel")
91 (global-set-key [mouse-wheel] 'mwheel-scroll)
92 (global-set-key [C-mouse-wheel] 'mwheel-scroll)
93 (global-set-key [S-mouse-wheel] 'mwheel-scroll)
95 (defun w32-drag-n-drop-debug (event)
96 "Print the drag-n-drop EVENT in a readable form."
97 (interactive "e")
98 (princ event))
100 (defun w32-drag-n-drop (event)
101 "Edit the files listed in the drag-n-drop EVENT.
102 Switch to a buffer editing the last file dropped."
103 (interactive "e")
104 (save-excursion
105 ;; Make sure the drop target has positive co-ords
106 ;; before setting the selected frame - otherwise it
107 ;; won't work. <skx@tardis.ed.ac.uk>
108 (let* ((window (posn-window (event-start event)))
109 (coords (posn-x-y (event-start event)))
110 (x (car coords))
111 (y (cdr coords)))
112 (if (and (> x 0) (> y 0))
113 (set-frame-selected-window nil window))
114 (mapcar 'find-file (car (cdr (cdr event)))))
115 (raise-frame)))
117 (defun w32-drag-n-drop-other-frame (event)
118 "Edit the files listed in the drag-n-drop EVENT, in other frames.
119 May create new frames, or reuse existing ones. The frame editing
120 the last file dropped is selected."
121 (interactive "e")
122 (mapcar 'find-file-other-frame (car (cdr (cdr event)))))
124 ;; Bind the drag-n-drop event.
125 (global-set-key [drag-n-drop] 'w32-drag-n-drop)
126 (global-set-key [C-drag-n-drop] 'w32-drag-n-drop-other-frame)
128 ;; Keyboard layout/language change events
129 ;; For now ignore language-change events; in the future
130 ;; we should switch the Emacs Input Method to match the
131 ;; new layout/language selected by the user.
132 (global-set-key [language-change] 'ignore)
134 (defvar x-invocation-args)
136 (defvar x-command-line-resources nil)
138 (defun x-handle-switch (switch)
139 "Handle SWITCH of the form \"-switch value\" or \"-switch\"."
140 (let ((aelt (assoc switch command-line-x-option-alist)))
141 (if aelt
142 (let ((param (nth 3 aelt))
143 (value (nth 4 aelt)))
144 (if value
145 (setq default-frame-alist
146 (cons (cons param value)
147 default-frame-alist))
148 (setq default-frame-alist
149 (cons (cons param
150 (car x-invocation-args))
151 default-frame-alist)
152 x-invocation-args (cdr x-invocation-args)))))))
154 (defun x-handle-numeric-switch (switch)
155 "Handle SWITCH of the form \"-switch n\"."
156 (let ((aelt (assoc switch command-line-x-option-alist)))
157 (if aelt
158 (let ((param (nth 3 aelt)))
159 (setq default-frame-alist
160 (cons (cons param
161 (string-to-int (car x-invocation-args)))
162 default-frame-alist)
163 x-invocation-args
164 (cdr x-invocation-args))))))
166 ;; Handle options that apply to initial frame only
167 (defun x-handle-initial-switch (switch)
168 (let ((aelt (assoc switch command-line-x-option-alist)))
169 (if aelt
170 (let ((param (nth 3 aelt))
171 (value (nth 4 aelt)))
172 (if value
173 (setq initial-frame-alist
174 (cons (cons param value)
175 initial-frame-alist))
176 (setq initial-frame-alist
177 (cons (cons param
178 (car x-invocation-args))
179 initial-frame-alist)
180 x-invocation-args (cdr x-invocation-args)))))))
182 (defun x-handle-iconic (switch)
183 "Make \"-iconic\" SWITCH apply only to the initial frame."
184 (setq initial-frame-alist
185 (cons '(visibility . icon) initial-frame-alist)))
187 (defun x-handle-xrm-switch (switch)
188 "Handle the \"-xrm\" SWITCH."
189 (or (consp x-invocation-args)
190 (error "%s: missing argument to `%s' option" (invocation-name) switch))
191 (setq x-command-line-resources
192 (if (null x-command-line-resources)
193 (car x-invocation-args)
194 (concat x-command-line-resources "\n" (car x-invocation-args))))
195 (setq x-invocation-args (cdr x-invocation-args)))
197 (defun x-handle-geometry (switch)
198 "Handle the \"-geometry\" SWITCH."
199 (let* ((geo (x-parse-geometry (car x-invocation-args)))
200 (left (assq 'left geo))
201 (top (assq 'top geo))
202 (height (assq 'height geo))
203 (width (assq 'width geo)))
204 (if (or height width)
205 (setq default-frame-alist
206 (append default-frame-alist
207 '((user-size . t))
208 (if height (list height))
209 (if width (list width)))
210 initial-frame-alist
211 (append initial-frame-alist
212 '((user-size . t))
213 (if height (list height))
214 (if width (list width)))))
215 (if (or left top)
216 (setq initial-frame-alist
217 (append initial-frame-alist
218 '((user-position . t))
219 (if left (list left))
220 (if top (list top)))))
221 (setq x-invocation-args (cdr x-invocation-args))))
223 (defun x-handle-name-switch (switch)
224 "Handle a \"-name\" SWITCH."
225 ;; Handle the -name option. Set the variable x-resource-name
226 ;; to the option's operand; set the name of the initial frame, too.
227 (or (consp x-invocation-args)
228 (error "%s: missing argument to `%s' option" (invocation-name) switch))
229 (setq x-resource-name (car x-invocation-args)
230 x-invocation-args (cdr x-invocation-args))
231 (setq initial-frame-alist (cons (cons 'name x-resource-name)
232 initial-frame-alist)))
234 (defvar x-display-name nil
235 "The display name specifying server and frame.")
237 (defun x-handle-display (switch)
238 "Handle the \"-display\" SWITCH."
239 (setq x-display-name (car x-invocation-args)
240 x-invocation-args (cdr x-invocation-args)))
242 (defun x-handle-args (args)
243 "Process the X-related command line options in ARGS.
244 This is done before the user's startup file is loaded. They are copied to
245 `x-invocation args' from which the X-related things are extracted, first
246 the switch (e.g., \"-fg\") in the following code, and possible values
247 \(e.g., \"black\") in the option handler code (e.g., x-handle-switch).
248 This returns ARGS with the arguments that have been processed removed."
249 ;; We use ARGS to accumulate the args that we don't handle here, to return.
250 (setq x-invocation-args args
251 args nil)
252 (while (and x-invocation-args
253 (not (equal (car x-invocation-args) "--")))
254 (let* ((this-switch (car x-invocation-args))
255 (orig-this-switch this-switch)
256 completion argval aelt handler)
257 (setq x-invocation-args (cdr x-invocation-args))
258 ;; Check for long options with attached arguments
259 ;; and separate out the attached option argument into argval.
260 (if (string-match "^--[^=]*=" this-switch)
261 (setq argval (substring this-switch (match-end 0))
262 this-switch (substring this-switch 0 (1- (match-end 0)))))
263 ;; Complete names of long options.
264 (if (string-match "^--" this-switch)
265 (progn
266 (setq completion (try-completion this-switch command-line-x-option-alist))
267 (if (eq completion t)
268 ;; Exact match for long option.
270 (if (stringp completion)
271 (let ((elt (assoc completion command-line-x-option-alist)))
272 ;; Check for abbreviated long option.
273 (or elt
274 (error "Option `%s' is ambiguous" this-switch))
275 (setq this-switch completion))))))
276 (setq aelt (assoc this-switch command-line-x-option-alist))
277 (if aelt (setq handler (nth 2 aelt)))
278 (if handler
279 (if argval
280 (let ((x-invocation-args
281 (cons argval x-invocation-args)))
282 (funcall handler this-switch))
283 (funcall handler this-switch))
284 (setq args (cons orig-this-switch args)))))
285 (nconc (nreverse args) x-invocation-args))
288 ;; Available colors
291 (defvar x-colors '("LightGreen"
292 "light green"
293 "DarkRed"
294 "dark red"
295 "DarkMagenta"
296 "dark magenta"
297 "DarkCyan"
298 "dark cyan"
299 "DarkBlue"
300 "dark blue"
301 "DarkGray"
302 "dark gray"
303 "DarkGrey"
304 "dark grey"
305 "grey100"
306 "gray100"
307 "grey99"
308 "gray99"
309 "grey98"
310 "gray98"
311 "grey97"
312 "gray97"
313 "grey96"
314 "gray96"
315 "grey95"
316 "gray95"
317 "grey94"
318 "gray94"
319 "grey93"
320 "gray93"
321 "grey92"
322 "gray92"
323 "grey91"
324 "gray91"
325 "grey90"
326 "gray90"
327 "grey89"
328 "gray89"
329 "grey88"
330 "gray88"
331 "grey87"
332 "gray87"
333 "grey86"
334 "gray86"
335 "grey85"
336 "gray85"
337 "grey84"
338 "gray84"
339 "grey83"
340 "gray83"
341 "grey82"
342 "gray82"
343 "grey81"
344 "gray81"
345 "grey80"
346 "gray80"
347 "grey79"
348 "gray79"
349 "grey78"
350 "gray78"
351 "grey77"
352 "gray77"
353 "grey76"
354 "gray76"
355 "grey75"
356 "gray75"
357 "grey74"
358 "gray74"
359 "grey73"
360 "gray73"
361 "grey72"
362 "gray72"
363 "grey71"
364 "gray71"
365 "grey70"
366 "gray70"
367 "grey69"
368 "gray69"
369 "grey68"
370 "gray68"
371 "grey67"
372 "gray67"
373 "grey66"
374 "gray66"
375 "grey65"
376 "gray65"
377 "grey64"
378 "gray64"
379 "grey63"
380 "gray63"
381 "grey62"
382 "gray62"
383 "grey61"
384 "gray61"
385 "grey60"
386 "gray60"
387 "grey59"
388 "gray59"
389 "grey58"
390 "gray58"
391 "grey57"
392 "gray57"
393 "grey56"
394 "gray56"
395 "grey55"
396 "gray55"
397 "grey54"
398 "gray54"
399 "grey53"
400 "gray53"
401 "grey52"
402 "gray52"
403 "grey51"
404 "gray51"
405 "grey50"
406 "gray50"
407 "grey49"
408 "gray49"
409 "grey48"
410 "gray48"
411 "grey47"
412 "gray47"
413 "grey46"
414 "gray46"
415 "grey45"
416 "gray45"
417 "grey44"
418 "gray44"
419 "grey43"
420 "gray43"
421 "grey42"
422 "gray42"
423 "grey41"
424 "gray41"
425 "grey40"
426 "gray40"
427 "grey39"
428 "gray39"
429 "grey38"
430 "gray38"
431 "grey37"
432 "gray37"
433 "grey36"
434 "gray36"
435 "grey35"
436 "gray35"
437 "grey34"
438 "gray34"
439 "grey33"
440 "gray33"
441 "grey32"
442 "gray32"
443 "grey31"
444 "gray31"
445 "grey30"
446 "gray30"
447 "grey29"
448 "gray29"
449 "grey28"
450 "gray28"
451 "grey27"
452 "gray27"
453 "grey26"
454 "gray26"
455 "grey25"
456 "gray25"
457 "grey24"
458 "gray24"
459 "grey23"
460 "gray23"
461 "grey22"
462 "gray22"
463 "grey21"
464 "gray21"
465 "grey20"
466 "gray20"
467 "grey19"
468 "gray19"
469 "grey18"
470 "gray18"
471 "grey17"
472 "gray17"
473 "grey16"
474 "gray16"
475 "grey15"
476 "gray15"
477 "grey14"
478 "gray14"
479 "grey13"
480 "gray13"
481 "grey12"
482 "gray12"
483 "grey11"
484 "gray11"
485 "grey10"
486 "gray10"
487 "grey9"
488 "gray9"
489 "grey8"
490 "gray8"
491 "grey7"
492 "gray7"
493 "grey6"
494 "gray6"
495 "grey5"
496 "gray5"
497 "grey4"
498 "gray4"
499 "grey3"
500 "gray3"
501 "grey2"
502 "gray2"
503 "grey1"
504 "gray1"
505 "grey0"
506 "gray0"
507 "thistle4"
508 "thistle3"
509 "thistle2"
510 "thistle1"
511 "MediumPurple4"
512 "MediumPurple3"
513 "MediumPurple2"
514 "MediumPurple1"
515 "purple4"
516 "purple3"
517 "purple2"
518 "purple1"
519 "DarkOrchid4"
520 "DarkOrchid3"
521 "DarkOrchid2"
522 "DarkOrchid1"
523 "MediumOrchid4"
524 "MediumOrchid3"
525 "MediumOrchid2"
526 "MediumOrchid1"
527 "plum4"
528 "plum3"
529 "plum2"
530 "plum1"
531 "orchid4"
532 "orchid3"
533 "orchid2"
534 "orchid1"
535 "magenta4"
536 "magenta3"
537 "magenta2"
538 "magenta1"
539 "VioletRed4"
540 "VioletRed3"
541 "VioletRed2"
542 "VioletRed1"
543 "maroon4"
544 "maroon3"
545 "maroon2"
546 "maroon1"
547 "PaleVioletRed4"
548 "PaleVioletRed3"
549 "PaleVioletRed2"
550 "PaleVioletRed1"
551 "LightPink4"
552 "LightPink3"
553 "LightPink2"
554 "LightPink1"
555 "pink4"
556 "pink3"
557 "pink2"
558 "pink1"
559 "HotPink4"
560 "HotPink3"
561 "HotPink2"
562 "HotPink1"
563 "DeepPink4"
564 "DeepPink3"
565 "DeepPink2"
566 "DeepPink1"
567 "red4"
568 "red3"
569 "red2"
570 "red1"
571 "OrangeRed4"
572 "OrangeRed3"
573 "OrangeRed2"
574 "OrangeRed1"
575 "tomato4"
576 "tomato3"
577 "tomato2"
578 "tomato1"
579 "coral4"
580 "coral3"
581 "coral2"
582 "coral1"
583 "DarkOrange4"
584 "DarkOrange3"
585 "DarkOrange2"
586 "DarkOrange1"
587 "orange4"
588 "orange3"
589 "orange2"
590 "orange1"
591 "LightSalmon4"
592 "LightSalmon3"
593 "LightSalmon2"
594 "LightSalmon1"
595 "salmon4"
596 "salmon3"
597 "salmon2"
598 "salmon1"
599 "brown4"
600 "brown3"
601 "brown2"
602 "brown1"
603 "firebrick4"
604 "firebrick3"
605 "firebrick2"
606 "firebrick1"
607 "chocolate4"
608 "chocolate3"
609 "chocolate2"
610 "chocolate1"
611 "tan4"
612 "tan3"
613 "tan2"
614 "tan1"
615 "wheat4"
616 "wheat3"
617 "wheat2"
618 "wheat1"
619 "burlywood4"
620 "burlywood3"
621 "burlywood2"
622 "burlywood1"
623 "sienna4"
624 "sienna3"
625 "sienna2"
626 "sienna1"
627 "IndianRed4"
628 "IndianRed3"
629 "IndianRed2"
630 "IndianRed1"
631 "RosyBrown4"
632 "RosyBrown3"
633 "RosyBrown2"
634 "RosyBrown1"
635 "DarkGoldenrod4"
636 "DarkGoldenrod3"
637 "DarkGoldenrod2"
638 "DarkGoldenrod1"
639 "goldenrod4"
640 "goldenrod3"
641 "goldenrod2"
642 "goldenrod1"
643 "gold4"
644 "gold3"
645 "gold2"
646 "gold1"
647 "yellow4"
648 "yellow3"
649 "yellow2"
650 "yellow1"
651 "LightYellow4"
652 "LightYellow3"
653 "LightYellow2"
654 "LightYellow1"
655 "LightGoldenrod4"
656 "LightGoldenrod3"
657 "LightGoldenrod2"
658 "LightGoldenrod1"
659 "khaki4"
660 "khaki3"
661 "khaki2"
662 "khaki1"
663 "DarkOliveGreen4"
664 "DarkOliveGreen3"
665 "DarkOliveGreen2"
666 "DarkOliveGreen1"
667 "OliveDrab4"
668 "OliveDrab3"
669 "OliveDrab2"
670 "OliveDrab1"
671 "chartreuse4"
672 "chartreuse3"
673 "chartreuse2"
674 "chartreuse1"
675 "green4"
676 "green3"
677 "green2"
678 "green1"
679 "SpringGreen4"
680 "SpringGreen3"
681 "SpringGreen2"
682 "SpringGreen1"
683 "PaleGreen4"
684 "PaleGreen3"
685 "PaleGreen2"
686 "PaleGreen1"
687 "SeaGreen4"
688 "SeaGreen3"
689 "SeaGreen2"
690 "SeaGreen1"
691 "DarkSeaGreen4"
692 "DarkSeaGreen3"
693 "DarkSeaGreen2"
694 "DarkSeaGreen1"
695 "aquamarine4"
696 "aquamarine3"
697 "aquamarine2"
698 "aquamarine1"
699 "DarkSlateGray4"
700 "DarkSlateGray3"
701 "DarkSlateGray2"
702 "DarkSlateGray1"
703 "cyan4"
704 "cyan3"
705 "cyan2"
706 "cyan1"
707 "turquoise4"
708 "turquoise3"
709 "turquoise2"
710 "turquoise1"
711 "CadetBlue4"
712 "CadetBlue3"
713 "CadetBlue2"
714 "CadetBlue1"
715 "PaleTurquoise4"
716 "PaleTurquoise3"
717 "PaleTurquoise2"
718 "PaleTurquoise1"
719 "LightCyan4"
720 "LightCyan3"
721 "LightCyan2"
722 "LightCyan1"
723 "LightBlue4"
724 "LightBlue3"
725 "LightBlue2"
726 "LightBlue1"
727 "LightSteelBlue4"
728 "LightSteelBlue3"
729 "LightSteelBlue2"
730 "LightSteelBlue1"
731 "SlateGray4"
732 "SlateGray3"
733 "SlateGray2"
734 "SlateGray1"
735 "LightSkyBlue4"
736 "LightSkyBlue3"
737 "LightSkyBlue2"
738 "LightSkyBlue1"
739 "SkyBlue4"
740 "SkyBlue3"
741 "SkyBlue2"
742 "SkyBlue1"
743 "DeepSkyBlue4"
744 "DeepSkyBlue3"
745 "DeepSkyBlue2"
746 "DeepSkyBlue1"
747 "SteelBlue4"
748 "SteelBlue3"
749 "SteelBlue2"
750 "SteelBlue1"
751 "DodgerBlue4"
752 "DodgerBlue3"
753 "DodgerBlue2"
754 "DodgerBlue1"
755 "blue4"
756 "blue3"
757 "blue2"
758 "blue1"
759 "RoyalBlue4"
760 "RoyalBlue3"
761 "RoyalBlue2"
762 "RoyalBlue1"
763 "SlateBlue4"
764 "SlateBlue3"
765 "SlateBlue2"
766 "SlateBlue1"
767 "azure4"
768 "azure3"
769 "azure2"
770 "azure1"
771 "MistyRose4"
772 "MistyRose3"
773 "MistyRose2"
774 "MistyRose1"
775 "LavenderBlush4"
776 "LavenderBlush3"
777 "LavenderBlush2"
778 "LavenderBlush1"
779 "honeydew4"
780 "honeydew3"
781 "honeydew2"
782 "honeydew1"
783 "ivory4"
784 "ivory3"
785 "ivory2"
786 "ivory1"
787 "cornsilk4"
788 "cornsilk3"
789 "cornsilk2"
790 "cornsilk1"
791 "LemonChiffon4"
792 "LemonChiffon3"
793 "LemonChiffon2"
794 "LemonChiffon1"
795 "NavajoWhite4"
796 "NavajoWhite3"
797 "NavajoWhite2"
798 "NavajoWhite1"
799 "PeachPuff4"
800 "PeachPuff3"
801 "PeachPuff2"
802 "PeachPuff1"
803 "bisque4"
804 "bisque3"
805 "bisque2"
806 "bisque1"
807 "AntiqueWhite4"
808 "AntiqueWhite3"
809 "AntiqueWhite2"
810 "AntiqueWhite1"
811 "seashell4"
812 "seashell3"
813 "seashell2"
814 "seashell1"
815 "snow4"
816 "snow3"
817 "snow2"
818 "snow1"
819 "thistle"
820 "MediumPurple"
821 "medium purple"
822 "purple"
823 "BlueViolet"
824 "blue violet"
825 "DarkViolet"
826 "dark violet"
827 "DarkOrchid"
828 "dark orchid"
829 "MediumOrchid"
830 "medium orchid"
831 "orchid"
832 "plum"
833 "violet"
834 "magenta"
835 "VioletRed"
836 "violet red"
837 "MediumVioletRed"
838 "medium violet red"
839 "maroon"
840 "PaleVioletRed"
841 "pale violet red"
842 "LightPink"
843 "light pink"
844 "pink"
845 "DeepPink"
846 "deep pink"
847 "HotPink"
848 "hot pink"
849 "red"
850 "OrangeRed"
851 "orange red"
852 "tomato"
853 "LightCoral"
854 "light coral"
855 "coral"
856 "DarkOrange"
857 "dark orange"
858 "orange"
859 "LightSalmon"
860 "light salmon"
861 "salmon"
862 "DarkSalmon"
863 "dark salmon"
864 "brown"
865 "firebrick"
866 "chocolate"
867 "tan"
868 "SandyBrown"
869 "sandy brown"
870 "wheat"
871 "beige"
872 "burlywood"
873 "peru"
874 "sienna"
875 "SaddleBrown"
876 "saddle brown"
877 "IndianRed"
878 "indian red"
879 "RosyBrown"
880 "rosy brown"
881 "DarkGoldenrod"
882 "dark goldenrod"
883 "goldenrod"
884 "LightGoldenrod"
885 "light goldenrod"
886 "gold"
887 "yellow"
888 "LightYellow"
889 "light yellow"
890 "LightGoldenrodYellow"
891 "light goldenrod yellow"
892 "PaleGoldenrod"
893 "pale goldenrod"
894 "khaki"
895 "DarkKhaki"
896 "dark khaki"
897 "OliveDrab"
898 "olive drab"
899 "ForestGreen"
900 "forest green"
901 "YellowGreen"
902 "yellow green"
903 "LimeGreen"
904 "lime green"
905 "GreenYellow"
906 "green yellow"
907 "MediumSpringGreen"
908 "medium spring green"
909 "chartreuse"
910 "green"
911 "LawnGreen"
912 "lawn green"
913 "SpringGreen"
914 "spring green"
915 "PaleGreen"
916 "pale green"
917 "LightSeaGreen"
918 "light sea green"
919 "MediumSeaGreen"
920 "medium sea green"
921 "SeaGreen"
922 "sea green"
923 "DarkSeaGreen"
924 "dark sea green"
925 "DarkOliveGreen"
926 "dark olive green"
927 "DarkGreen"
928 "dark green"
929 "aquamarine"
930 "MediumAquamarine"
931 "medium aquamarine"
932 "CadetBlue"
933 "cadet blue"
934 "LightCyan"
935 "light cyan"
936 "cyan"
937 "turquoise"
938 "MediumTurquoise"
939 "medium turquoise"
940 "DarkTurquoise"
941 "dark turquoise"
942 "PaleTurquoise"
943 "pale turquoise"
944 "PowderBlue"
945 "powder blue"
946 "LightBlue"
947 "light blue"
948 "LightSteelBlue"
949 "light steel blue"
950 "SteelBlue"
951 "steel blue"
952 "LightSkyBlue"
953 "light sky blue"
954 "SkyBlue"
955 "sky blue"
956 "DeepSkyBlue"
957 "deep sky blue"
958 "DodgerBlue"
959 "dodger blue"
960 "blue"
961 "RoyalBlue"
962 "royal blue"
963 "MediumBlue"
964 "medium blue"
965 "LightSlateBlue"
966 "light slate blue"
967 "MediumSlateBlue"
968 "medium slate blue"
969 "SlateBlue"
970 "slate blue"
971 "DarkSlateBlue"
972 "dark slate blue"
973 "CornflowerBlue"
974 "cornflower blue"
975 "NavyBlue"
976 "navy blue"
977 "navy"
978 "MidnightBlue"
979 "midnight blue"
980 "LightGray"
981 "light gray"
982 "LightGrey"
983 "light grey"
984 "grey"
985 "gray"
986 "LightSlateGrey"
987 "light slate grey"
988 "LightSlateGray"
989 "light slate gray"
990 "SlateGrey"
991 "slate grey"
992 "SlateGray"
993 "slate gray"
994 "DimGrey"
995 "dim grey"
996 "DimGray"
997 "dim gray"
998 "DarkSlateGrey"
999 "dark slate grey"
1000 "DarkSlateGray"
1001 "dark slate gray"
1002 "black"
1003 "white"
1004 "MistyRose"
1005 "misty rose"
1006 "LavenderBlush"
1007 "lavender blush"
1008 "lavender"
1009 "AliceBlue"
1010 "alice blue"
1011 "azure"
1012 "MintCream"
1013 "mint cream"
1014 "honeydew"
1015 "seashell"
1016 "LemonChiffon"
1017 "lemon chiffon"
1018 "ivory"
1019 "cornsilk"
1020 "moccasin"
1021 "NavajoWhite"
1022 "navajo white"
1023 "PeachPuff"
1024 "peach puff"
1025 "bisque"
1026 "BlanchedAlmond"
1027 "blanched almond"
1028 "PapayaWhip"
1029 "papaya whip"
1030 "AntiqueWhite"
1031 "antique white"
1032 "linen"
1033 "OldLace"
1034 "old lace"
1035 "FloralWhite"
1036 "floral white"
1037 "gainsboro"
1038 "WhiteSmoke"
1039 "white smoke"
1040 "GhostWhite"
1041 "ghost white"
1042 "snow")
1043 "The list of X colors from the `rgb.txt' file.
1044 XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
1046 (defun xw-defined-colors (&optional frame)
1047 "Internal function called by `defined-colors', which see."
1048 (or frame (setq frame (selected-frame)))
1049 (let* ((color-map-colors (mapcar (lambda (clr) (car clr)) w32-color-map))
1050 (all-colors (or color-map-colors x-colors))
1051 (this-color nil)
1052 (defined-colors nil))
1053 (message "Defining colors...")
1054 (while all-colors
1055 (setq this-color (car all-colors)
1056 all-colors (cdr all-colors))
1057 (and (color-supported-p this-color frame t)
1058 (setq defined-colors (cons this-color defined-colors))))
1059 defined-colors))
1062 ;;;; Function keys
1064 ;;; make f10 activate the real menubar rather than the mini-buffer menu
1065 ;;; navigation feature.
1066 (global-set-key [f10] (lambda ()
1067 (interactive) (w32-send-sys-command ?\xf100)))
1069 (defun iconify-or-deiconify-frame ()
1070 "Iconify the selected frame, or deiconify if it's currently an icon."
1071 (interactive)
1072 (if (eq (cdr (assq 'visibility (frame-parameters))) t)
1073 (iconify-frame)
1074 (make-frame-visible)))
1076 (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
1077 global-map)
1080 ;;; Do the actual Windows setup here; the above code just defines
1081 ;;; functions and variables that we use now.
1083 (setq command-line-args (x-handle-args command-line-args))
1085 ;;; Make sure we have a valid resource name.
1086 (or (stringp x-resource-name)
1087 (let (i)
1088 (setq x-resource-name (invocation-name))
1090 ;; Change any . or * characters in x-resource-name to hyphens,
1091 ;; so as not to choke when we use it in X resource queries.
1092 (while (setq i (string-match "[.*]" x-resource-name))
1093 (aset x-resource-name i ?-))))
1095 ;; For the benefit of older Emacses (19.27 and earlier) that are sharing
1096 ;; the same lisp directory, don't pass the third argument unless we seem
1097 ;; to have the multi-display support.
1098 (if (fboundp 'x-close-connection)
1099 (x-open-connection ""
1100 x-command-line-resources
1101 ;; Exit Emacs with fatal error if this fails.
1103 (x-open-connection ""
1104 x-command-line-resources))
1106 (setq frame-creation-function 'x-create-frame-with-faces)
1108 (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
1109 x-cut-buffer-max))
1111 ;; W32 expects the menu bar cut and paste commands to use the clipboard.
1112 ;; This has ,? to match both on Sunos and on Solaris.
1113 (menu-bar-enable-clipboard)
1115 ;; W32 systems have different fonts than commonly found on X, so
1116 ;; we define our own standard fontset here.
1117 (defvar w32-standard-fontset-spec
1118 "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-fontset-standard"
1119 "String of fontset spec of the standard fontset.
1120 This defines a fontset consisting of the Courier New variations for
1121 European languages which are distributed with Windows as
1122 \"Multilanguage Support\".
1124 See the documentation of `create-fontset-from-fontset-spec for the format.")
1126 ;; Conditional on new-fontset so bootstrapping works on non-GUI compiles
1127 (if (fboundp 'new-fontset)
1128 (progn
1129 ;; Setup the default fontset.
1130 (setup-default-fontset)
1131 ;; Create the standard fontset.
1132 (create-fontset-from-fontset-spec w32-standard-fontset-spec t)
1133 ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1,...).
1134 (create-fontset-from-x-resource)
1135 ;; Try to create a fontset from a font specification which comes
1136 ;; from initial-frame-alist, default-frame-alist, or X resource.
1137 ;; A font specification in command line argument (i.e. -fn XXXX)
1138 ;; should be already in default-frame-alist as a `font'
1139 ;; parameter. However, any font specifications in site-start
1140 ;; library, user's init file (.emacs), and default.el are not
1141 ;; yet handled here.
1143 (let ((font (or (cdr (assq 'font initial-frame-alist))
1144 (cdr (assq 'font default-frame-alist))
1145 (x-get-resource "font" "Font")))
1146 xlfd-fields resolved-name)
1147 (if (and font
1148 (not (query-fontset font))
1149 (setq resolved-name (x-resolve-font-name font))
1150 (setq xlfd-fields (x-decompose-font-name font)))
1151 (if (string= "fontset"
1152 (aref xlfd-fields xlfd-regexp-registry-subnum))
1153 (new-fontset font
1154 (x-complement-fontset-spec xlfd-fields nil))
1155 ;; Create a fontset from FONT. The fontset name is
1156 ;; generated from FONT.
1157 (create-fontset-from-ascii-font font
1158 resolved-name "startup"))))))
1160 ;; Apply a geometry resource to the initial frame. Put it at the end
1161 ;; of the alist, so that anything specified on the command line takes
1162 ;; precedence.
1163 (let* ((res-geometry (x-get-resource "geometry" "Geometry"))
1164 parsed)
1165 (if res-geometry
1166 (progn
1167 (setq parsed (x-parse-geometry res-geometry))
1168 ;; If the resource specifies a position,
1169 ;; call the position and size "user-specified".
1170 (if (or (assq 'top parsed) (assq 'left parsed))
1171 (setq parsed (cons '(user-position . t)
1172 (cons '(user-size . t) parsed))))
1173 ;; All geometry parms apply to the initial frame.
1174 (setq initial-frame-alist (append initial-frame-alist parsed))
1175 ;; The size parms apply to all frames.
1176 (if (assq 'height parsed)
1177 (setq default-frame-alist
1178 (cons (cons 'height (cdr (assq 'height parsed)))
1179 default-frame-alist)))
1180 (if (assq 'width parsed)
1181 (setq default-frame-alist
1182 (cons (cons 'width (cdr (assq 'width parsed)))
1183 default-frame-alist))))))
1185 ;; Check the reverseVideo resource.
1186 (let ((case-fold-search t))
1187 (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
1188 (if (and rv
1189 (string-match "^\\(true\\|yes\\|on\\)$" rv))
1190 (setq default-frame-alist
1191 (cons '(reverse . t) default-frame-alist)))))
1193 (defun x-win-suspend-error ()
1194 "Report an error when a suspend is attempted."
1195 (error "Suspending an Emacs running under W32 makes no sense"))
1196 (add-hook 'suspend-hook 'x-win-suspend-error)
1198 ;;; Turn off window-splitting optimization; w32 is usually fast enough
1199 ;;; that this is only annoying.
1200 (setq split-window-keep-point t)
1202 ;; Don't show the frame name; that's redundant.
1203 (setq-default mode-line-frame-identification " ")
1205 ;;; Set to a system sound if you want a fancy bell.
1206 (set-message-beep 'ok)
1208 ;; Remap some functions to call w32 common dialogs
1210 (defun internal-face-interactive (what &optional bool)
1211 (let* ((fn (intern (concat "face-" what)))
1212 (prompt (concat "Set " what " of face "))
1213 (face (read-face-name prompt))
1214 (default (if (fboundp fn)
1215 (or (funcall fn face (selected-frame))
1216 (funcall fn 'default (selected-frame)))))
1217 (fn-win (intern (concat (symbol-name window-system) "-select-" what)))
1218 value)
1219 (setq value
1220 (cond ((fboundp fn-win)
1221 (funcall fn-win))
1222 ((eq bool 'color)
1223 (completing-read (concat prompt " " (symbol-name face) " to: ")
1224 (mapcar (function (lambda (color)
1225 (cons color color)))
1226 x-colors)
1227 nil nil nil nil default))
1228 (bool
1229 (y-or-n-p (concat "Should face " (symbol-name face)
1230 " be " bool "? ")))
1232 (read-string (concat prompt " " (symbol-name face) " to: ")
1233 nil nil default))))
1234 (list face (if (equal value "") nil value))))
1236 ;;; Enable Japanese fonts on Windows to be used by default.
1237 (set-fontset-font nil (make-char 'katakana-jisx0201) '("*" . "JISX0208-SJIS"))
1238 (set-fontset-font nil (make-char 'latin-jisx0201) '("*" . "JISX0208-SJIS"))
1239 (set-fontset-font nil (make-char 'japanese-jisx0208) '("*" . "JISX0208-SJIS"))
1240 (set-fontset-font nil (make-char 'japanese-jisx0208-1978) '("*" . "JISX0208-SJIS"))
1242 (defun mouse-set-font (&rest fonts)
1243 "Select a font.
1244 If `w32-use-w32-font-dialog' is non-nil (the default), use the Windows
1245 font dialog to get the matching FONTS. Otherwise use a pop-up menu
1246 \(like Emacs on other platforms) initialized with the fonts in
1247 `w32-fixed-font-alist'."
1248 (interactive
1249 (if w32-use-w32-font-dialog
1250 (let ((chosen-font (w32-select-font (selected-frame)
1251 w32-list-proportional-fonts)))
1252 (and chosen-font (list chosen-font)))
1253 (x-popup-menu
1254 last-nonmenu-event
1255 ;; Append list of fontsets currently defined.
1256 ;; Conditional on new-fontset so bootstrapping works on non-GUI compiles
1257 (if (fboundp 'new-fontset)
1258 (append w32-fixed-font-alist (list (generate-fontset-menu)))))))
1259 (if fonts
1260 (let (font)
1261 (while fonts
1262 (condition-case nil
1263 (progn
1264 (setq font (car fonts))
1265 (set-default-font font)
1266 (setq fonts nil))
1267 (error (setq fonts (cdr fonts)))))
1268 (if (null font)
1269 (error "Font not found")))))
1271 ;;; w32-win.el ends here