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