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