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