Fix up multi-tty merge
[bpt/emacs.git] / lisp / term / x-win.el
CommitLineData
cf07d2bd 1;;; x-win.el --- parse relevant switches and set up for X -*-coding: iso-2022-7bit;-*-
2fe590dc 2
5fd6d89f 3;; Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004,
d7a0267c 4;; 2005, 2006, 2007 Free Software Foundation, Inc.
5cdb3f1e
ER
5
6;; Author: FSF
cf07d2bd 7;; Keywords: terminals, i18n
5cdb3f1e 8
2fe590dc
EN
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
5a9dffec 13;; the Free Software Foundation; either version 3, or (at your option)
2fe590dc
EN
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
4fc5845f
LK
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
63f77899 25
5cdb3f1e 26;;; Commentary:
63f77899 27
e9cda827
KL
28;; X-win.el: this file defines functions to initialize the X window
29;; system and process X-specific command line parameters before
30;; creating the first X frame.
31
32;; Note that contrary to previous Emacs versions, the act of loading
33;; this file should not have the side effect of initializing the
34;; window system or processing command line arguments (this file is
35;; now loaded in loadup.el). See the variables
36;; `handle-args-function-alist' and
37;; `window-system-initialization-alist' for more details.
63f77899
JB
38
39;; startup.el will then examine startup files, and eventually call the hooks
cf07d2bd 40;; which create the first window(s).
5cdb3f1e
ER
41
42;;; Code:
63f77899
JB
43\f
44;; These are the standard X switches from the Xt Initialize.c file of
45;; Release 4.
46
47;; Command line Resource Manager string
48
49;; +rv *reverseVideo
50;; +synchronous *synchronous
51;; -background *background
52;; -bd *borderColor
53;; -bg *background
54;; -bordercolor *borderColor
55;; -borderwidth .borderWidth
56;; -bw .borderWidth
57;; -display .display
58;; -fg *foreground
59;; -fn *font
60;; -font *font
61;; -foreground *foreground
62;; -geometry .geometry
63;; -iconic .iconic
64;; -name .name
65;; -reverse *reverseVideo
66;; -rv *reverseVideo
67;; -selectionTimeout .selectionTimeout
68;; -synchronous *synchronous
63f77899
JB
69;; -xrm
70
63f77899
JB
71;; An alist of X options and the function which handles them. See
72;; ../startup.el.
73
2246281f 74(if (not (fboundp 'x-create-frame))
800642d2 75 (error "%s: Loading x-win.el but not compiled for X" (invocation-name)))
db95369b 76
0cc89026 77(require 'frame)
3eb43f71 78(require 'mouse)
b16795eb 79(require 'scroll-bar)
ffe1dd7a
JB
80(require 'faces)
81(require 'select)
290cb602 82(require 'menu-bar)
6acdd93e 83(require 'fontset)
6b61353c 84(require 'x-dnd)
63c86e17 85
19b08de9 86(defvar x-invocation-args)
cc5e32c5
JB
87(defvar x-keysym-table)
88(defvar x-selection-timeout)
89(defvar x-session-id)
90(defvar x-session-previous-id)
19b08de9 91
f6f6d98c
RS
92(defvar x-command-line-resources nil)
93
63f77899
JB
94;; Handler for switches of the form "-switch value" or "-switch".
95(defun x-handle-switch (switch)
80128ceb 96 (let ((aelt (assoc switch command-line-x-option-alist)))
63f77899 97 (if aelt
80128ceb
RS
98 (let ((param (nth 3 aelt))
99 (value (nth 4 aelt)))
100 (if value
101 (setq default-frame-alist
102 (cons (cons param value)
103 default-frame-alist))
0cc89026 104 (setq default-frame-alist
80128ceb
RS
105 (cons (cons param
106 (car x-invocation-args))
107 default-frame-alist)
108 x-invocation-args (cdr x-invocation-args)))))))
109
110;; Handler for switches of the form "-switch n"
111(defun x-handle-numeric-switch (switch)
112 (let ((aelt (assoc switch command-line-x-option-alist)))
113 (if aelt
114 (let ((param (nth 3 aelt)))
0cc89026 115 (setq default-frame-alist
80128ceb 116 (cons (cons param
027a4b6b 117 (string-to-number (car x-invocation-args)))
0cc89026 118 default-frame-alist)
80128ceb
RS
119 x-invocation-args
120 (cdr x-invocation-args))))))
63f77899 121
2f9b363a
EZ
122;; Handle options that apply to initial frame only
123(defun x-handle-initial-switch (switch)
124 (let ((aelt (assoc switch command-line-x-option-alist)))
125 (if aelt
126 (let ((param (nth 3 aelt))
127 (value (nth 4 aelt)))
128 (if value
129 (setq initial-frame-alist
130 (cons (cons param value)
131 initial-frame-alist))
132 (setq initial-frame-alist
133 (cons (cons param
134 (car x-invocation-args))
135 initial-frame-alist)
136 x-invocation-args (cdr x-invocation-args)))))))
137
0389072b
JD
138(defun x-handle-no-bitmap-icon (switch)
139 (setq default-frame-alist (cons '(icon-type) default-frame-alist)))
140
ef599142
RS
141;; Make -iconic apply only to the initial frame!
142(defun x-handle-iconic (switch)
143 (setq initial-frame-alist
144 (cons '(visibility . icon) initial-frame-alist)))
145
800642d2
JB
146;; Handle the -xrm option.
147(defun x-handle-xrm-switch (switch)
2025ddca
GM
148 (unless (consp x-invocation-args)
149 (error "%s: missing argument to `%s' option" (invocation-name) switch))
150 (setq x-command-line-resources
151 (if (null x-command-line-resources)
152 (car x-invocation-args)
153 (concat x-command-line-resources "\n" (car x-invocation-args))))
f6f6d98c
RS
154 (setq x-invocation-args (cdr x-invocation-args)))
155
63f77899
JB
156;; Handle the geometry option
157(defun x-handle-geometry (switch)
ea8d3061
RS
158 (let* ((geo (x-parse-geometry (car x-invocation-args)))
159 (left (assq 'left geo))
160 (top (assq 'top geo))
161 (height (assq 'height geo))
162 (width (assq 'width geo)))
163 (if (or height width)
164 (setq default-frame-alist
165 (append default-frame-alist
bfabe882
RS
166 '((user-size . t))
167 (if height (list height))
168 (if width (list width)))
169 initial-frame-alist
170 (append initial-frame-alist
ea8d3061
RS
171 '((user-size . t))
172 (if height (list height))
173 (if width (list width)))))
174 (if (or left top)
175 (setq initial-frame-alist
176 (append initial-frame-alist
177 '((user-position . t))
178 (if left (list left))
179 (if top (list top)))))
180 (setq x-invocation-args (cdr x-invocation-args))))
63f77899 181
66f229be
RS
182;; Handle the -name option. Set the variable x-resource-name
183;; to the option's operand; set the name of
800642d2 184;; the initial frame, too.
66f229be 185(defun x-handle-name-switch (switch)
800642d2
JB
186 (or (consp x-invocation-args)
187 (error "%s: missing argument to `%s' option" (invocation-name) switch))
188 (setq x-resource-name (car x-invocation-args)
189 x-invocation-args (cdr x-invocation-args))
66f229be
RS
190 (setq initial-frame-alist (cons (cons 'name x-resource-name)
191 initial-frame-alist)))
800642d2 192
63f77899 193(defvar x-display-name nil
6f6c5fb3
CY
194 "The name of the X display on which Emacs was started.
195
366f1741 196For the X display name of individual frames, see the `display'
6f6c5fb3 197frame parameter.")
63f77899
JB
198
199(defun x-handle-display (switch)
e50f1c1a 200 "Handle -display DISPLAY option."
63f77899 201 (setq x-display-name (car x-invocation-args)
d98f0b87
RS
202 x-invocation-args (cdr x-invocation-args))
203 ;; Make subshell programs see the same DISPLAY value Emacs really uses.
204 ;; Note that this isn't completely correct, since Emacs can use
205 ;; multiple displays. However, there is no way to tell an already
206 ;; running subshell which display the user is currently typing on.
207 (setenv "DISPLAY" x-display-name))
63f77899 208
8769d648 209(defun x-handle-args (args)
dc20df95
RS
210 "Process the X-related command line options in ARGS.
211This is done before the user's startup file is loaded. They are copied to
80128ceb 212`x-invocation-args', from which the X-related things are extracted, first
8769d648 213the switch (e.g., \"-fg\") in the following code, and possible values
a4e104bf 214\(e.g., \"black\") in the option handler code (e.g., x-handle-switch).
80128ceb
RS
215This function returns ARGS minus the arguments that have been processed."
216 ;; We use ARGS to accumulate the args that we don't handle here, to return.
63c86e17
JB
217 (setq x-invocation-args args
218 args nil)
0dd96d4c
RS
219 (while (and x-invocation-args
220 (not (equal (car x-invocation-args) "--")))
63c86e17 221 (let* ((this-switch (car x-invocation-args))
e491912f 222 (orig-this-switch this-switch)
80128ceb 223 completion argval aelt handler)
63c86e17 224 (setq x-invocation-args (cdr x-invocation-args))
e491912f
RS
225 ;; Check for long options with attached arguments
226 ;; and separate out the attached option argument into argval.
227 (if (string-match "^--[^=]*=" this-switch)
228 (setq argval (substring this-switch (match-end 0))
229 this-switch (substring this-switch 0 (1- (match-end 0)))))
80128ceb
RS
230 ;; Complete names of long options.
231 (if (string-match "^--" this-switch)
232 (progn
233 (setq completion (try-completion this-switch command-line-x-option-alist))
234 (if (eq completion t)
235 ;; Exact match for long option.
236 nil
237 (if (stringp completion)
238 (let ((elt (assoc completion command-line-x-option-alist)))
239 ;; Check for abbreviated long option.
240 (or elt
241 (error "Option `%s' is ambiguous" this-switch))
242 (setq this-switch completion))))))
243 (setq aelt (assoc this-switch command-line-x-option-alist))
244 (if aelt (setq handler (nth 2 aelt)))
245 (if handler
e491912f
RS
246 (if argval
247 (let ((x-invocation-args
248 (cons argval x-invocation-args)))
80128ceb
RS
249 (funcall handler this-switch))
250 (funcall handler this-switch))
251 (setq args (cons orig-this-switch args)))))
0dd96d4c 252 (nconc (nreverse args) x-invocation-args))
941a391a
JD
253
254;; Handle the --smid switch. This is used by the session manager
255;; to give us back our session id we had on the previous run.
256(defun x-handle-smid (switch)
257 (or (consp x-invocation-args)
258 (error "%s: missing argument to `%s' option" (invocation-name) switch))
259 (setq x-session-previous-id (car x-invocation-args)
260 x-invocation-args (cdr x-invocation-args)))
261
262(defvar emacs-save-session-functions nil
c3ef5084
SM
263 "Special hook run when a save-session event occurs.
264The functions do not get any argument.
941a391a
JD
265Functions can return non-nil to inform the session manager that the
266window system shutdown should be aborted.
267
268See also `emacs-session-save'.")
269
270(defun emacs-session-filename (session-id)
271 "Construct a filename to save the session in based on SESSION-ID.
272If the directory ~/.emacs.d exists, we make a filename in there, otherwise
273a file in the home directory."
274 (let ((basename (concat "session." session-id))
c093939c 275 (emacs-dir user-emacs-directory))
941a391a
JD
276 (expand-file-name (if (file-directory-p emacs-dir)
277 (concat emacs-dir basename)
278 (concat "~/.emacs-" basename)))))
db95369b 279
941a391a
JD
280(defun emacs-session-save ()
281 "This function is called when the window system is shutting down.
282If this function returns non-nil, the window system shutdown is cancelled.
283
284When a session manager tells Emacs that the window system is shutting
285down, this function is called. It calls the functions in the hook
286`emacs-save-session-functions'. Functions are called with the current
287buffer set to a temporary buffer. Functions should use `insert' to insert
288lisp code to save the session state. The buffer is saved
289in a file in the home directory of the user running Emacs. The file
290is evaluated when Emacs is restarted by the session manager.
291
292If any of the functions returns non-nil, no more functions are called
293and this function returns non-nil. This will inform the session manager
294that it should abort the window system shutdown."
295 (let ((filename (emacs-session-filename x-session-id))
296 (buf (get-buffer-create (concat " *SES " x-session-id))))
297 (when (file-exists-p filename)
298 (delete-file filename))
299 (with-current-buffer buf
300 (let ((cancel-shutdown (condition-case nil
3842fde1 301 ;; A return of t means cancel the shutdown.
db95369b 302 (run-hook-with-args-until-success
941a391a
JD
303 'emacs-save-session-functions)
304 (error t))))
305 (unless cancel-shutdown
306 (write-file filename))
307 (kill-buffer buf)
308 cancel-shutdown))))
309
1e4f6cec 310(defun emacs-session-restore (previous-session-id)
941a391a
JD
311 "Restore the Emacs session if started by a session manager.
312The file saved by `emacs-session-save' is evaluated and deleted if it
313exists."
1e4f6cec 314 (let ((filename (emacs-session-filename previous-session-id)))
941a391a
JD
315 (when (file-exists-p filename)
316 (load-file filename)
317 (delete-file filename)
318 (message "Restored session data"))))
319
db95369b
JB
320
321
63f77899
JB
322\f
323;;
324;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them.
325;;
326
327(defconst x-pointer-X-cursor 0)
328(defconst x-pointer-arrow 2)
329(defconst x-pointer-based-arrow-down 4)
330(defconst x-pointer-based-arrow-up 6)
331(defconst x-pointer-boat 8)
332(defconst x-pointer-bogosity 10)
333(defconst x-pointer-bottom-left-corner 12)
334(defconst x-pointer-bottom-right-corner 14)
335(defconst x-pointer-bottom-side 16)
336(defconst x-pointer-bottom-tee 18)
337(defconst x-pointer-box-spiral 20)
338(defconst x-pointer-center-ptr 22)
339(defconst x-pointer-circle 24)
340(defconst x-pointer-clock 26)
341(defconst x-pointer-coffee-mug 28)
342(defconst x-pointer-cross 30)
343(defconst x-pointer-cross-reverse 32)
344(defconst x-pointer-crosshair 34)
345(defconst x-pointer-diamond-cross 36)
346(defconst x-pointer-dot 38)
347(defconst x-pointer-dotbox 40)
348(defconst x-pointer-double-arrow 42)
349(defconst x-pointer-draft-large 44)
350(defconst x-pointer-draft-small 46)
351(defconst x-pointer-draped-box 48)
352(defconst x-pointer-exchange 50)
353(defconst x-pointer-fleur 52)
354(defconst x-pointer-gobbler 54)
355(defconst x-pointer-gumby 56)
356(defconst x-pointer-hand1 58)
357(defconst x-pointer-hand2 60)
358(defconst x-pointer-heart 62)
359(defconst x-pointer-icon 64)
360(defconst x-pointer-iron-cross 66)
361(defconst x-pointer-left-ptr 68)
362(defconst x-pointer-left-side 70)
363(defconst x-pointer-left-tee 72)
364(defconst x-pointer-leftbutton 74)
365(defconst x-pointer-ll-angle 76)
366(defconst x-pointer-lr-angle 78)
367(defconst x-pointer-man 80)
368(defconst x-pointer-middlebutton 82)
369(defconst x-pointer-mouse 84)
370(defconst x-pointer-pencil 86)
371(defconst x-pointer-pirate 88)
372(defconst x-pointer-plus 90)
373(defconst x-pointer-question-arrow 92)
374(defconst x-pointer-right-ptr 94)
375(defconst x-pointer-right-side 96)
376(defconst x-pointer-right-tee 98)
377(defconst x-pointer-rightbutton 100)
378(defconst x-pointer-rtl-logo 102)
379(defconst x-pointer-sailboat 104)
380(defconst x-pointer-sb-down-arrow 106)
381(defconst x-pointer-sb-h-double-arrow 108)
382(defconst x-pointer-sb-left-arrow 110)
383(defconst x-pointer-sb-right-arrow 112)
384(defconst x-pointer-sb-up-arrow 114)
385(defconst x-pointer-sb-v-double-arrow 116)
386(defconst x-pointer-shuttle 118)
387(defconst x-pointer-sizing 120)
388(defconst x-pointer-spider 122)
389(defconst x-pointer-spraycan 124)
390(defconst x-pointer-star 126)
391(defconst x-pointer-target 128)
392(defconst x-pointer-tcross 130)
393(defconst x-pointer-top-left-arrow 132)
394(defconst x-pointer-top-left-corner 134)
395(defconst x-pointer-top-right-corner 136)
396(defconst x-pointer-top-side 138)
397(defconst x-pointer-top-tee 140)
398(defconst x-pointer-trek 142)
399(defconst x-pointer-ul-angle 144)
400(defconst x-pointer-umbrella 146)
401(defconst x-pointer-ur-angle 148)
402(defconst x-pointer-watch 150)
403(defconst x-pointer-xterm 152)
5cb94d12 404(defconst x-pointer-invisible 255)
63f77899
JB
405\f
406;;
407;; Available colors
408;;
409
38fb1ad4
GM
410(defvar x-colors '("LightGreen"
411 "light green"
412 "DarkRed"
413 "dark red"
414 "DarkMagenta"
415 "dark magenta"
416 "DarkCyan"
417 "dark cyan"
418 "DarkBlue"
419 "dark blue"
420 "DarkGray"
421 "dark gray"
422 "DarkGrey"
423 "dark grey"
424 "grey100"
425 "gray100"
426 "grey99"
427 "gray99"
428 "grey98"
429 "gray98"
430 "grey97"
431 "gray97"
432 "grey96"
433 "gray96"
434 "grey95"
435 "gray95"
436 "grey94"
437 "gray94"
438 "grey93"
439 "gray93"
440 "grey92"
441 "gray92"
442 "grey91"
443 "gray91"
444 "grey90"
445 "gray90"
446 "grey89"
447 "gray89"
448 "grey88"
449 "gray88"
450 "grey87"
451 "gray87"
452 "grey86"
453 "gray86"
454 "grey85"
455 "gray85"
456 "grey84"
457 "gray84"
458 "grey83"
459 "gray83"
460 "grey82"
461 "gray82"
462 "grey81"
463 "gray81"
464 "grey80"
465 "gray80"
466 "grey79"
467 "gray79"
468 "grey78"
469 "gray78"
470 "grey77"
471 "gray77"
472 "grey76"
473 "gray76"
474 "grey75"
475 "gray75"
476 "grey74"
477 "gray74"
478 "grey73"
479 "gray73"
480 "grey72"
481 "gray72"
482 "grey71"
483 "gray71"
484 "grey70"
485 "gray70"
486 "grey69"
487 "gray69"
488 "grey68"
489 "gray68"
490 "grey67"
491 "gray67"
492 "grey66"
493 "gray66"
494 "grey65"
495 "gray65"
496 "grey64"
497 "gray64"
498 "grey63"
499 "gray63"
500 "grey62"
501 "gray62"
502 "grey61"
503 "gray61"
504 "grey60"
505 "gray60"
506 "grey59"
507 "gray59"
508 "grey58"
509 "gray58"
510 "grey57"
511 "gray57"
512 "grey56"
513 "gray56"
514 "grey55"
515 "gray55"
516 "grey54"
517 "gray54"
518 "grey53"
519 "gray53"
520 "grey52"
521 "gray52"
522 "grey51"
523 "gray51"
524 "grey50"
525 "gray50"
526 "grey49"
527 "gray49"
528 "grey48"
529 "gray48"
530 "grey47"
531 "gray47"
532 "grey46"
533 "gray46"
534 "grey45"
535 "gray45"
536 "grey44"
537 "gray44"
538 "grey43"
539 "gray43"
540 "grey42"
541 "gray42"
542 "grey41"
543 "gray41"
544 "grey40"
545 "gray40"
546 "grey39"
547 "gray39"
548 "grey38"
549 "gray38"
550 "grey37"
551 "gray37"
552 "grey36"
553 "gray36"
554 "grey35"
555 "gray35"
556 "grey34"
557 "gray34"
558 "grey33"
559 "gray33"
560 "grey32"
561 "gray32"
562 "grey31"
563 "gray31"
564 "grey30"
565 "gray30"
566 "grey29"
567 "gray29"
568 "grey28"
569 "gray28"
570 "grey27"
571 "gray27"
572 "grey26"
573 "gray26"
574 "grey25"
575 "gray25"
576 "grey24"
577 "gray24"
578 "grey23"
579 "gray23"
580 "grey22"
581 "gray22"
582 "grey21"
583 "gray21"
584 "grey20"
585 "gray20"
586 "grey19"
587 "gray19"
588 "grey18"
589 "gray18"
590 "grey17"
591 "gray17"
592 "grey16"
593 "gray16"
594 "grey15"
595 "gray15"
596 "grey14"
597 "gray14"
598 "grey13"
599 "gray13"
600 "grey12"
601 "gray12"
602 "grey11"
603 "gray11"
604 "grey10"
605 "gray10"
606 "grey9"
607 "gray9"
608 "grey8"
609 "gray8"
610 "grey7"
611 "gray7"
612 "grey6"
613 "gray6"
614 "grey5"
615 "gray5"
616 "grey4"
617 "gray4"
618 "grey3"
619 "gray3"
620 "grey2"
621 "gray2"
622 "grey1"
623 "gray1"
624 "grey0"
625 "gray0"
626 "thistle4"
627 "thistle3"
628 "thistle2"
629 "thistle1"
630 "MediumPurple4"
631 "MediumPurple3"
632 "MediumPurple2"
633 "MediumPurple1"
634 "purple4"
635 "purple3"
636 "purple2"
637 "purple1"
638 "DarkOrchid4"
639 "DarkOrchid3"
640 "DarkOrchid2"
641 "DarkOrchid1"
642 "MediumOrchid4"
643 "MediumOrchid3"
644 "MediumOrchid2"
645 "MediumOrchid1"
646 "plum4"
647 "plum3"
648 "plum2"
649 "plum1"
650 "orchid4"
651 "orchid3"
652 "orchid2"
653 "orchid1"
654 "magenta4"
655 "magenta3"
656 "magenta2"
657 "magenta1"
658 "VioletRed4"
659 "VioletRed3"
660 "VioletRed2"
661 "VioletRed1"
662 "maroon4"
663 "maroon3"
664 "maroon2"
665 "maroon1"
666 "PaleVioletRed4"
667 "PaleVioletRed3"
668 "PaleVioletRed2"
669 "PaleVioletRed1"
670 "LightPink4"
671 "LightPink3"
672 "LightPink2"
673 "LightPink1"
674 "pink4"
675 "pink3"
676 "pink2"
677 "pink1"
678 "HotPink4"
679 "HotPink3"
680 "HotPink2"
681 "HotPink1"
682 "DeepPink4"
683 "DeepPink3"
684 "DeepPink2"
685 "DeepPink1"
686 "red4"
687 "red3"
688 "red2"
689 "red1"
690 "OrangeRed4"
691 "OrangeRed3"
692 "OrangeRed2"
693 "OrangeRed1"
694 "tomato4"
695 "tomato3"
696 "tomato2"
697 "tomato1"
698 "coral4"
699 "coral3"
700 "coral2"
701 "coral1"
702 "DarkOrange4"
703 "DarkOrange3"
704 "DarkOrange2"
705 "DarkOrange1"
706 "orange4"
707 "orange3"
708 "orange2"
709 "orange1"
710 "LightSalmon4"
711 "LightSalmon3"
712 "LightSalmon2"
713 "LightSalmon1"
714 "salmon4"
715 "salmon3"
716 "salmon2"
717 "salmon1"
718 "brown4"
719 "brown3"
720 "brown2"
721 "brown1"
722 "firebrick4"
723 "firebrick3"
724 "firebrick2"
725 "firebrick1"
726 "chocolate4"
727 "chocolate3"
728 "chocolate2"
729 "chocolate1"
730 "tan4"
731 "tan3"
732 "tan2"
733 "tan1"
734 "wheat4"
735 "wheat3"
736 "wheat2"
737 "wheat1"
738 "burlywood4"
739 "burlywood3"
740 "burlywood2"
741 "burlywood1"
742 "sienna4"
743 "sienna3"
744 "sienna2"
745 "sienna1"
746 "IndianRed4"
747 "IndianRed3"
748 "IndianRed2"
749 "IndianRed1"
750 "RosyBrown4"
751 "RosyBrown3"
752 "RosyBrown2"
753 "RosyBrown1"
754 "DarkGoldenrod4"
755 "DarkGoldenrod3"
756 "DarkGoldenrod2"
757 "DarkGoldenrod1"
758 "goldenrod4"
759 "goldenrod3"
760 "goldenrod2"
761 "goldenrod1"
762 "gold4"
763 "gold3"
764 "gold2"
765 "gold1"
766 "yellow4"
767 "yellow3"
768 "yellow2"
769 "yellow1"
770 "LightYellow4"
771 "LightYellow3"
772 "LightYellow2"
773 "LightYellow1"
774 "LightGoldenrod4"
775 "LightGoldenrod3"
776 "LightGoldenrod2"
777 "LightGoldenrod1"
778 "khaki4"
779 "khaki3"
780 "khaki2"
781 "khaki1"
782 "DarkOliveGreen4"
783 "DarkOliveGreen3"
784 "DarkOliveGreen2"
785 "DarkOliveGreen1"
786 "OliveDrab4"
787 "OliveDrab3"
788 "OliveDrab2"
789 "OliveDrab1"
790 "chartreuse4"
791 "chartreuse3"
792 "chartreuse2"
793 "chartreuse1"
794 "green4"
795 "green3"
796 "green2"
797 "green1"
798 "SpringGreen4"
799 "SpringGreen3"
800 "SpringGreen2"
801 "SpringGreen1"
802 "PaleGreen4"
803 "PaleGreen3"
804 "PaleGreen2"
805 "PaleGreen1"
806 "SeaGreen4"
807 "SeaGreen3"
808 "SeaGreen2"
809 "SeaGreen1"
810 "DarkSeaGreen4"
811 "DarkSeaGreen3"
812 "DarkSeaGreen2"
813 "DarkSeaGreen1"
814 "aquamarine4"
815 "aquamarine3"
816 "aquamarine2"
817 "aquamarine1"
818 "DarkSlateGray4"
819 "DarkSlateGray3"
820 "DarkSlateGray2"
821 "DarkSlateGray1"
822 "cyan4"
823 "cyan3"
824 "cyan2"
825 "cyan1"
826 "turquoise4"
827 "turquoise3"
828 "turquoise2"
829 "turquoise1"
830 "CadetBlue4"
831 "CadetBlue3"
832 "CadetBlue2"
833 "CadetBlue1"
834 "PaleTurquoise4"
835 "PaleTurquoise3"
836 "PaleTurquoise2"
837 "PaleTurquoise1"
838 "LightCyan4"
839 "LightCyan3"
840 "LightCyan2"
841 "LightCyan1"
842 "LightBlue4"
843 "LightBlue3"
844 "LightBlue2"
845 "LightBlue1"
846 "LightSteelBlue4"
847 "LightSteelBlue3"
848 "LightSteelBlue2"
849 "LightSteelBlue1"
850 "SlateGray4"
851 "SlateGray3"
852 "SlateGray2"
853 "SlateGray1"
854 "LightSkyBlue4"
855 "LightSkyBlue3"
856 "LightSkyBlue2"
857 "LightSkyBlue1"
858 "SkyBlue4"
859 "SkyBlue3"
860 "SkyBlue2"
861 "SkyBlue1"
862 "DeepSkyBlue4"
863 "DeepSkyBlue3"
864 "DeepSkyBlue2"
865 "DeepSkyBlue1"
866 "SteelBlue4"
867 "SteelBlue3"
868 "SteelBlue2"
869 "SteelBlue1"
870 "DodgerBlue4"
871 "DodgerBlue3"
872 "DodgerBlue2"
873 "DodgerBlue1"
874 "blue4"
875 "blue3"
876 "blue2"
877 "blue1"
878 "RoyalBlue4"
879 "RoyalBlue3"
880 "RoyalBlue2"
881 "RoyalBlue1"
882 "SlateBlue4"
883 "SlateBlue3"
884 "SlateBlue2"
885 "SlateBlue1"
886 "azure4"
887 "azure3"
888 "azure2"
889 "azure1"
890 "MistyRose4"
891 "MistyRose3"
892 "MistyRose2"
893 "MistyRose1"
894 "LavenderBlush4"
895 "LavenderBlush3"
896 "LavenderBlush2"
897 "LavenderBlush1"
898 "honeydew4"
899 "honeydew3"
900 "honeydew2"
901 "honeydew1"
902 "ivory4"
903 "ivory3"
904 "ivory2"
905 "ivory1"
906 "cornsilk4"
907 "cornsilk3"
908 "cornsilk2"
909 "cornsilk1"
910 "LemonChiffon4"
911 "LemonChiffon3"
912 "LemonChiffon2"
913 "LemonChiffon1"
914 "NavajoWhite4"
915 "NavajoWhite3"
916 "NavajoWhite2"
917 "NavajoWhite1"
918 "PeachPuff4"
919 "PeachPuff3"
920 "PeachPuff2"
921 "PeachPuff1"
922 "bisque4"
923 "bisque3"
924 "bisque2"
925 "bisque1"
926 "AntiqueWhite4"
927 "AntiqueWhite3"
928 "AntiqueWhite2"
929 "AntiqueWhite1"
930 "seashell4"
931 "seashell3"
932 "seashell2"
933 "seashell1"
934 "snow4"
935 "snow3"
936 "snow2"
937 "snow1"
938 "thistle"
939 "MediumPurple"
940 "medium purple"
941 "purple"
942 "BlueViolet"
943 "blue violet"
944 "DarkViolet"
945 "dark violet"
946 "DarkOrchid"
947 "dark orchid"
948 "MediumOrchid"
949 "medium orchid"
950 "orchid"
951 "plum"
952 "violet"
953 "magenta"
954 "VioletRed"
955 "violet red"
956 "MediumVioletRed"
957 "medium violet red"
958 "maroon"
959 "PaleVioletRed"
960 "pale violet red"
961 "LightPink"
962 "light pink"
963 "pink"
964 "DeepPink"
965 "deep pink"
966 "HotPink"
967 "hot pink"
968 "red"
969 "OrangeRed"
970 "orange red"
971 "tomato"
972 "LightCoral"
973 "light coral"
63f77899 974 "coral"
38fb1ad4
GM
975 "DarkOrange"
976 "dark orange"
977 "orange"
978 "LightSalmon"
979 "light salmon"
980 "salmon"
981 "DarkSalmon"
982 "dark salmon"
63f77899 983 "brown"
38fb1ad4
GM
984 "firebrick"
985 "chocolate"
986 "tan"
987 "SandyBrown"
988 "sandy brown"
989 "wheat"
990 "beige"
991 "burlywood"
992 "peru"
993 "sienna"
994 "SaddleBrown"
995 "saddle brown"
996 "IndianRed"
997 "indian red"
998 "RosyBrown"
999 "rosy brown"
1000 "DarkGoldenrod"
1001 "dark goldenrod"
63f77899 1002 "goldenrod"
38fb1ad4
GM
1003 "LightGoldenrod"
1004 "light goldenrod"
1005 "gold"
1006 "yellow"
1007 "LightYellow"
1008 "light yellow"
1009 "LightGoldenrodYellow"
1010 "light goldenrod yellow"
1011 "PaleGoldenrod"
1012 "pale goldenrod"
1013 "khaki"
1014 "DarkKhaki"
1015 "dark khaki"
1016 "OliveDrab"
1017 "olive drab"
63f77899 1018 "ForestGreen"
38fb1ad4
GM
1019 "forest green"
1020 "YellowGreen"
1021 "yellow green"
63f77899 1022 "LimeGreen"
38fb1ad4
GM
1023 "lime green"
1024 "GreenYellow"
1025 "green yellow"
63f77899 1026 "MediumSpringGreen"
38fb1ad4
GM
1027 "medium spring green"
1028 "chartreuse"
1029 "green"
1030 "LawnGreen"
1031 "lawn green"
1032 "SpringGreen"
1033 "spring green"
63f77899 1034 "PaleGreen"
38fb1ad4
GM
1035 "pale green"
1036 "LightSeaGreen"
1037 "light sea green"
1038 "MediumSeaGreen"
1039 "medium sea green"
63f77899 1040 "SeaGreen"
38fb1ad4
GM
1041 "sea green"
1042 "DarkSeaGreen"
1043 "dark sea green"
1044 "DarkOliveGreen"
1045 "dark olive green"
1046 "DarkGreen"
1047 "dark green"
1048 "aquamarine"
1049 "MediumAquamarine"
1050 "medium aquamarine"
1051 "CadetBlue"
1052 "cadet blue"
1053 "LightCyan"
1054 "light cyan"
1055 "cyan"
63f77899 1056 "turquoise"
63f77899 1057 "MediumTurquoise"
38fb1ad4
GM
1058 "medium turquoise"
1059 "DarkTurquoise"
1060 "dark turquoise"
1061 "PaleTurquoise"
1062 "pale turquoise"
1063 "PowderBlue"
1064 "powder blue"
1065 "LightBlue"
1066 "light blue"
1067 "LightSteelBlue"
1068 "light steel blue"
1069 "SteelBlue"
1070 "steel blue"
1071 "LightSkyBlue"
1072 "light sky blue"
1073 "SkyBlue"
1074 "sky blue"
1075 "DeepSkyBlue"
1076 "deep sky blue"
1077 "DodgerBlue"
1078 "dodger blue"
1079 "blue"
1080 "RoyalBlue"
1081 "royal blue"
1082 "MediumBlue"
1083 "medium blue"
1084 "LightSlateBlue"
1085 "light slate blue"
1086 "MediumSlateBlue"
1087 "medium slate blue"
1088 "SlateBlue"
1089 "slate blue"
1090 "DarkSlateBlue"
1091 "dark slate blue"
1092 "CornflowerBlue"
1093 "cornflower blue"
1094 "NavyBlue"
1095 "navy blue"
1096 "navy"
1097 "MidnightBlue"
1098 "midnight blue"
1099 "LightGray"
1100 "light gray"
1101 "LightGrey"
1102 "light grey"
1103 "grey"
1104 "gray"
1105 "LightSlateGrey"
1106 "light slate grey"
1107 "LightSlateGray"
1108 "light slate gray"
1109 "SlateGrey"
1110 "slate grey"
1111 "SlateGray"
1112 "slate gray"
1113 "DimGrey"
1114 "dim grey"
1115 "DimGray"
1116 "dim gray"
1117 "DarkSlateGrey"
1118 "dark slate grey"
1119 "DarkSlateGray"
1120 "dark slate gray"
1121 "black"
63f77899 1122 "white"
38fb1ad4
GM
1123 "MistyRose"
1124 "misty rose"
1125 "LavenderBlush"
1126 "lavender blush"
1127 "lavender"
1128 "AliceBlue"
1129 "alice blue"
1130 "azure"
1131 "MintCream"
1132 "mint cream"
1133 "honeydew"
1134 "seashell"
1135 "LemonChiffon"
1136 "lemon chiffon"
1137 "ivory"
1138 "cornsilk"
1139 "moccasin"
1140 "NavajoWhite"
1141 "navajo white"
1142 "PeachPuff"
1143 "peach puff"
1144 "bisque"
1145 "BlanchedAlmond"
1146 "blanched almond"
1147 "PapayaWhip"
1148 "papaya whip"
1149 "AntiqueWhite"
1150 "antique white"
1151 "linen"
1152 "OldLace"
1153 "old lace"
1154 "FloralWhite"
1155 "floral white"
1156 "gainsboro"
1157 "WhiteSmoke"
1158 "white smoke"
1159 "GhostWhite"
1160 "ghost white"
1161 "snow")
1162 "The list of X colors from the `rgb.txt' file.
1163XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
63f77899 1164
f795f633
EZ
1165(defun xw-defined-colors (&optional frame)
1166 "Internal function called by `defined-colors', which see."
891eb3fe 1167 (or frame (setq frame (selected-frame)))
63f77899
JB
1168 (let ((all-colors x-colors)
1169 (this-color nil)
1170 (defined-colors nil))
1171 (while all-colors
1172 (setq this-color (car all-colors)
1173 all-colors (cdr all-colors))
79b24da3 1174 (and (color-supported-p this-color frame t)
63f77899
JB
1175 (setq defined-colors (cons this-color defined-colors))))
1176 defined-colors))
63f77899 1177\f
98bf0c8d
JB
1178;;;; Function keys
1179
bbd2296c
SM
1180(defvar x-alternatives-map
1181 (let ((map (make-sparse-keymap)))
1182 ;; Map certain keypad keys into ASCII characters that people usually expect.
1183 (define-key map [backspace] [127])
1184 (define-key map [delete] [127])
1185 (define-key map [tab] [?\t])
1186 (define-key map [linefeed] [?\n])
1187 (define-key map [clear] [?\C-l])
1188 (define-key map [return] [?\C-m])
1189 (define-key map [escape] [?\e])
1190 (define-key map [M-backspace] [?\M-\d])
1191 (define-key map [M-delete] [?\M-\d])
1192 (define-key map [M-tab] [?\M-\t])
1193 (define-key map [M-linefeed] [?\M-\n])
1194 (define-key map [M-clear] [?\M-\C-l])
1195 (define-key map [M-return] [?\M-\C-m])
1196 (define-key map [M-escape] [?\M-\e])
1197 (define-key map [iso-lefttab] [backtab])
f6959eb4 1198 (define-key map [S-iso-lefttab] [backtab])
bbd2296c
SM
1199 map)
1200 "Keymap of possible alternative meanings for some keys.")
1201
2bb819d5
KL
1202(defun x-setup-function-keys (frame)
1203 "Set up `function-key-map' on FRAME for the X window system."
b97a79c4
KL
1204 ;; Don't do this twice on the same display, or it would break
1205 ;; normal-erase-is-backspace-mode.
1206 (unless (terminal-parameter frame 'x-setup-function-keys)
1207 ;; Map certain keypad keys into ASCII characters that people usually expect.
1208 (with-selected-frame frame
bbd2296c
SM
1209 (let ((map (copy-keymap x-alternatives-map)))
1210 (set-keymap-parent map (keymap-parent local-function-key-map))
1211 (set-keymap-parent local-function-key-map map)))
b97a79c4 1212 (set-terminal-parameter frame 'x-setup-function-keys t)))
3d80ef3f
RS
1213
1214;; These tell read-char how to convert
1215;; these special chars to ASCII.
1216(put 'backspace 'ascii-character 127)
1217(put 'delete 'ascii-character 127)
1218(put 'tab 'ascii-character ?\t)
1219(put 'linefeed 'ascii-character ?\n)
1220(put 'clear 'ascii-character 12)
1221(put 'return 'ascii-character 13)
1222(put 'escape 'ascii-character ?\e)
afa43349 1223
cf07d2bd
DL
1224\f
1225;;;; Keysyms
1226
9b4234ae 1227(defun vendor-specific-keysyms (vendor)
089bc712 1228 "Return the appropriate value of `system-key-alist' for VENDOR.
9b4234ae 1229VENDOR is a string containing the name of the X Server's vendor,
089bc712 1230as returned by `x-server-vendor'."
cf07d2bd 1231 ;; Fixme: Drop Apollo now?
9b4234ae
RS
1232 (cond ((string-equal vendor "Apollo Computer Inc.")
1233 '((65280 . linedel)
1234 (65281 . chardel)
1235 (65282 . copy)
1236 (65283 . cut)
1237 (65284 . paste)
1238 (65285 . move)
1239 (65286 . grow)
1240 (65287 . cmd)
1241 (65288 . shell)
1242 (65289 . leftbar)
1243 (65290 . rightbar)
1244 (65291 . leftbox)
1245 (65292 . rightbox)
1246 (65293 . upbox)
1247 (65294 . downbox)
1248 (65295 . pop)
1249 (65296 . read)
1250 (65297 . edit)
1251 (65298 . save)
1252 (65299 . exit)
1253 (65300 . repeat)))
3f18a142
KH
1254 ((or (string-equal vendor "Hewlett-Packard Incorporated")
1255 (string-equal vendor "Hewlett-Packard Company"))
9b4234ae
RS
1256 '(( 168 . mute-acute)
1257 ( 169 . mute-grave)
1258 ( 170 . mute-asciicircum)
1259 ( 171 . mute-diaeresis)
1260 ( 172 . mute-asciitilde)
1261 ( 175 . lira)
1262 ( 190 . guilder)
1263 ( 252 . block)
1264 ( 256 . longminus)
1265 (65388 . reset)
1266 (65389 . system)
1267 (65390 . user)
1268 (65391 . clearline)
1269 (65392 . insertline)
1270 (65393 . deleteline)
1271 (65394 . insertchar)
1272 (65395 . deletechar)
1273 (65396 . backtab)
1274 (65397 . kp-backtab)))
cf07d2bd 1275 ;; Fixme: What about non-X11/NeWS sun server?
04486a2d
KH
1276 ((or (string-equal vendor "X11/NeWS - Sun Microsystems Inc.")
1277 (string-equal vendor "X Consortium"))
51a8e1cc
KH
1278 '((392976 . f36)
1279 (392977 . f37)
9b4234ae
RS
1280 (393056 . req)
1281 ;; These are for Sun under X11R6
1282 (393072 . props)
1283 (393073 . front)
1284 (393074 . copy)
1285 (393075 . open)
1286 (393076 . paste)
1287 (393077 . cut)))
1288 (t
1289 ;; This is used by DEC's X server.
1290 '((65280 . remove)))))
1291
58fa26d4 1292;; Latin-1
cf07d2bd
DL
1293(let ((i 160))
1294 (while (< i 256)
1d912b36 1295 (puthash i i x-keysym-table)
cf07d2bd
DL
1296 (setq i (1+ i))))
1297
1298;; Table from Kuhn's proposed additions to the `KEYSYM Encoding'
1299;; appendix to the X protocol definition.
1300(dolist
1301 (pair
1302 '(
1303 ;; Latin-2
1304 (#x1a1 . ?\e,B!\e(B)
1305 (#x1a2 . ?\e,B"\e(B)
1306 (#x1a3 . ?\e,B#\e(B)
1307 (#x1a5 . ?\e,B%\e(B)
1308 (#x1a6 . ?\e,B&\e(B)
1309 (#x1a9 . ?\e,B)\e(B)
1310 (#x1aa . ?\e,B*\e(B)
1311 (#x1ab . ?\e,B+\e(B)
1312 (#x1ac . ?\e,B,\e(B)
1313 (#x1ae . ?\e,B.\e(B)
1314 (#x1af . ?\e,B/\e(B)
1315 (#x1b1 . ?\e,B1\e(B)
1316 (#x1b2 . ?\e,B2\e(B)
1317 (#x1b3 . ?\e,B3\e(B)
1318 (#x1b5 . ?\e,B5\e(B)
1319 (#x1b6 . ?\e,B6\e(B)
1320 (#x1b7 . ?\e,B7\e(B)
1321 (#x1b9 . ?\e,B9\e(B)
1322 (#x1ba . ?\e,B:\e(B)
1323 (#x1bb . ?\e,B;\e(B)
1324 (#x1bc . ?\e,B<\e(B)
1325 (#x1bd . ?\e,B=\e(B)
1326 (#x1be . ?\e,B>\e(B)
1327 (#x1bf . ?\e,B?\e(B)
1328 (#x1c0 . ?\e,B@\e(B)
1329 (#x1c3 . ?\e,BC\e(B)
1330 (#x1c5 . ?\e,BE\e(B)
1331 (#x1c6 . ?\e,BF\e(B)
1332 (#x1c8 . ?\e,BH\e(B)
1333 (#x1ca . ?\e,BJ\e(B)
1334 (#x1cc . ?\e,BL\e(B)
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. ?\e,Ce\e(B)
1379 (#x2e6 . ?\e,Cf\e(B)
1380 (#x2f5 . ?\e,Cu\e(B)
1381 (#x2f8 . ?\e,Cx\e(B)
1382 (#x2fd . ?\e,C}\e(B)
1383 (#x2fe . ?\e,C~\e(B)
1384 ;; Latin-4
1385 (#x3a2 . ?\e,D"\e(B)
1386 (#x3a3 . ?\e,D#\e(B)
1387 (#x3a5 . ?\e,D%\e(B)
1388 (#x3a6 . ?\e,D&\e(B)
1389 (#x3aa . ?\e,D*\e(B)
1390 (#x3ab . ?\e,D+\e(B)
1391 (#x3ac . ?\e,D,\e(B)
1392 (#x3b3 . ?\e,D3\e(B)
1393 (#x3b5 . ?\e,D5\e(B)
1394 (#x3b6 . ?\e,D6\e(B)
1395 (#x3ba . ?\e,D:\e(B)
1396 (#x3bb . ?\e,D;\e(B)
1397 (#x3bc . ?\e,D<\e(B)
1398 (#x3bd . ?\e,D=\e(B)
1399 (#x3bf . ?\e,D?\e(B)
1400 (#x3c0 . ?\e,D@\e(B)
1401 (#x3c7 . ?\e,DG\e(B)
1402 (#x3cc . ?\e,DL\e(B)
1403 (#x3cf . ?\e,DO\e(B)
1404 (#x3d1 . ?\e,DQ\e(B)
1405 (#x3d2 . ?\e,DR\e(B)
1406 (#x3d3 . ?\e,DS\e(B)
1407 (#x3d9 . ?\e,DY\e(B)
1408 (#x3dd . ?\e,D]\e(B)
1409 (#x3de . ?\e,D^\e(B)
1410 (#x3e0 . ?\e,D`\e(B)
1411 (#x3e7 . ?\e,Dg\e(B)
1412 (#x3ec . ?\e,Dl\e(B)
1413 (#x3ef . ?\e,Do\e(B)
1414 (#x3f1 . ?\e,Dq\e(B)
1415 (#x3f2 . ?\e,Dr\e(B)
1416 (#x3f3 . ?\e,Ds\e(B)
1417 (#x3f9 . ?\e,Dy\e(B)
1418 (#x3fd . ?\e,D}\e(B)
1419 (#x3fe . ?\e,D~\e(B)
1420 ;; Kana: Fixme: needs conversion to Japanese charset -- seems
1421 ;; to require jisx0213, for which the Unicode translation
1422 ;; isn't clear.
6b61353c
KH
1423 (#x47e . ?\e(J~\e(B)
1424 (#x4a1 . ?\e$A!#\e(B)
1425 (#x4a2 . ?\\e$A!8\e(B)
1426 (#x4a3 . ?\\e$A!9\e(B)
1427 (#x4a4 . ?\e$A!"\e(B)
1428 (#x4a5 . ?\e$A!$\e(B)
1429 (#x4a6 . ?\e$A%r\e(B)
1430 (#x4a7 . ?\e$A%!\e(B)
1431 (#x4a8 . ?\e$A%#\e(B)
1432 (#x4a9 . ?\e$A%%\e(B)
1433 (#x4aa . ?\e$A%'\e(B)
1434 (#x4ab . ?\e$A%)\e(B)
1435 (#x4ac . ?\e$A%c\e(B)
1436 (#x4ad . ?\e$A%e\e(B)
1437 (#x4ae . ?\e$A%g\e(B)
1438 (#x4af . ?\e$A%C\e(B)
1439 (#x4b0 . ?\e$B!<\e(B)
1440 (#x4b1 . ?\e$A%"\e(B)
1441 (#x4b2 . ?\e$A%$\e(B)
1442 (#x4b3 . ?\e$A%&\e(B)
1443 (#x4b4 . ?\e$A%(\e(B)
1444 (#x4b5 . ?\e$A%*\e(B)
1445 (#x4b6 . ?\e$A%+\e(B)
1446 (#x4b7 . ?\e$A%-\e(B)
1447 (#x4b8 . ?\e$A%/\e(B)
1448 (#x4b9 . ?\e$A%1\e(B)
1449 (#x4ba . ?\e$A%3\e(B)
1450 (#x4bb . ?\e$A%5\e(B)
1451 (#x4bc . ?\e$A%7\e(B)
1452 (#x4bd . ?\e$A%9\e(B)
1453 (#x4be . ?\e$A%;\e(B)
1454 (#x4bf . ?\e$A%=\e(B)
1455 (#x4c0 . ?\e$A%?\e(B)
1456 (#x4c1 . ?\e$A%A\e(B)
1457 (#x4c2 . ?\e$A%D\e(B)
1458 (#x4c3 . ?\e$A%F\e(B)
1459 (#x4c4 . ?\e$A%H\e(B)
1460 (#x4c5 . ?\e$A%J\e(B)
1461 (#x4c6 . ?\e$A%K\e(B)
1462 (#x4c7 . ?\e$A%L\e(B)
1463 (#x4c8 . ?\e$A%M\e(B)
1464 (#x4c9 . ?\e$A%N\e(B)
1465 (#x4ca . ?\e$A%O\e(B)
1466 (#x4cb . ?\e$A%R\e(B)
1467 (#x4cc . ?\e$A%U\e(B)
1468 (#x4cd . ?\e$A%X\e(B)
1469 (#x4ce . ?\e$A%[\e(B)
1470 (#x4cf . ?\e$A%^\e(B)
1471 (#x4d0 . ?\e$A%_\e(B)
1472 (#x4d1 . ?\e$A%`\e(B)
1473 (#x4d2 . ?\e$A%a\e(B)
1474 (#x4d3 . ?\e$A%b\e(B)
1475 (#x4d4 . ?\e$A%d\e(B)
1476 (#x4d5 . ?\e$A%f\e(B)
1477 (#x4d6 . ?\e$A%h\e(B)
1478 (#x4d7 . ?\e$A%i\e(B)
1479 (#x4d8 . ?\e$A%j\e(B)
1480 (#x4d9 . ?\e$A%k\e(B)
1481 (#x4da . ?\e$A%l\e(B)
1482 (#x4db . ?\e$A%m\e(B)
1483 (#x4dc . ?\e$A%o\e(B)
1484 (#x4dd . ?\e$A%s\e(B)
1485 (#x4de . ?\e$B!+\e(B)
1486 (#x4df . ?\e$B!,\e(B)
cf07d2bd
DL
1487 ;; Arabic
1488 (#x5ac . ?\e,G,\e(B)
1489 (#x5bb . ?\e,G;\e(B)
1490 (#x5bf . ?\e,G?\e(B)
1491 (#x5c1 . ?\e,GA\e(B)
1492 (#x5c2 . ?\e,GB\e(B)
1493 (#x5c3 . ?\e,GC\e(B)
1494 (#x5c4 . ?\e,GD\e(B)
1495 (#x5c5 . ?\e,GE\e(B)
1496 (#x5c6 . ?\e,GF\e(B)
1497 (#x5c7 . ?\e,GG\e(B)
1498 (#x5c8 . ?\e,GH\e(B)
1499 (#x5c9 . ?\e,GI\e(B)
1500 (#x5ca . ?\e,GJ\e(B)
1501 (#x5cb . ?\e,GK\e(B)
1502 (#x5cc . ?\e,GL\e(B)
1503 (#x5cd . ?\e,GM\e(B)
1504 (#x5ce . ?\e,GN\e(B)
1505 (#x5cf . ?\e,GO\e(B)
1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#x68c . ?\e$,1*8\e(B)
1549 (#x68d . ?\e$,1*B\e(B)
1550 (#x68e . ?\e$,1*H\e(B)
1551 (#x68f . ?\e$,1*N\e(B)
1552 (#x690 . ?\e$,1)S\e(B)
1553 (#x691 . ?\e$,1)W\e(B)
1554 (#x692 . ?\e$,1)[\e(B)
1555 (#x693 . ?\e$,1)]\e(B)
1556 (#x694 . ?\e$,1)c\e(B)
1557 (#x695 . ?\e$,1)o\e(B)
1558 (#x696 . ?\e$,1)q\e(B)
1559 (#x697 . ?\e$,1)s\e(B)
1560 (#x698 . ?\e$,1)w\e(B)
1561 (#x699 . ?\e$,1)y\e(B)
1562 (#x69a . ?\e$,1){\e(B)
1563 (#x69c . ?\e$,1*9\e(B)
1564 (#x69d . ?\e$,1*C\e(B)
1565 (#x69e . ?\e$,1*I\e(B)
1566 (#x69f . ?\e$,1*O\e(B)
cf07d2bd
DL
1567 (#x6a1 . ?\e,Lr\e(B)
1568 (#x6a2 . ?\e,Ls\e(B)
1569 (#x6a3 . ?\e,Lq\e(B)
1570 (#x6a4 . ?\e,Lt\e(B)
1571 (#x6a5 . ?\e,Lu\e(B)
1572 (#x6a6 . ?\e,Lv\e(B)
1573 (#x6a7 . ?\e,Lw\e(B)
1574 (#x6a8 . ?\e,Lx\e(B)
1575 (#x6a9 . ?\e,Ly\e(B)
1576 (#x6aa . ?\e,Lz\e(B)
1577 (#x6ab . ?\e,L{\e(B)
1578 (#x6ac . ?\e,L|\e(B)
1579 (#x6ae . ?\e,L~\e(B)
1580 (#x6af . ?\e,L\7f\e(B)
1581 (#x6b0 . ?\e,Lp\e(B)
1582 (#x6b1 . ?\e,L"\e(B)
1583 (#x6b2 . ?\e,L#\e(B)
1584 (#x6b3 . ?\e,L!\e(B)
1585 (#x6b4 . ?\e,L$\e(B)
1586 (#x6b5 . ?\e,L%\e(B)
1587 (#x6b6 . ?\e,L&\e(B)
1588 (#x6b7 . ?\e,L'\e(B)
1589 (#x6b8 . ?\e,L(\e(B)
1590 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#x8cd . ?\e$B"N\e(B)
1760 (#x8ce . ?\e$B"M\e(B)
1761 (#x8cf . ?\e$A!T\e(B)
1762 (#x8d6 . ?\e$A!L\e(B)
1763 (#x8da . ?\e$B">\e(B)
1764 (#x8db . ?\e$B"?\e(B)
1765 (#x8dc . ?\e$A!I\e(B)
1766 (#x8dd . ?\e$A!H\e(B)
1767 (#x8de . ?\e$A!D\e(B)
1768 (#x8df . ?\e$A!E\e(B)
1769 (#x8ef . ?\e$B"_\e(B)
cf07d2bd 1770 (#x8f6 . ?\e$,1!R\e(B)
6b61353c
KH
1771 (#x8fb . ?\e$A!{\e(B)
1772 (#x8fc . ?\e$A!|\e(B)
1773 (#x8fd . ?\e$A!z\e(B)
1774 (#x8fe . ?\e$A!}\e(B)
cf07d2bd 1775 ;; Special
6b61353c
KH
1776 (#x9e0 . ?\e$A!t\e(B)
1777 (#x9e1 . ?\e$(C"F\e(B)
1778 (#x9e2 . ?\e$(GB*\e(B)
1779 (#x9e3 . ?\e$(GB-\e(B)
1780 (#x9e4 . ?\e$(GB.\e(B)
1781 (#x9e5 . ?\e$(GB+\e(B)
cf07d2bd 1782 (#x9e8 . ?\e$,1}d\e(B)
6b61353c
KH
1783 (#x9e9 . ?\e$(GB,\e(B)
1784 (#x9ea . ?\e$A)<\e(B)
1785 (#x9eb . ?\e$A)4\e(B)
1786 (#x9ec . ?\e$A)0\e(B)
1787 (#x9ed . ?\e$A)8\e(B)
1788 (#x9ee . ?\e$A)`\e(B)
cf07d2bd
DL
1789 (#x9ef . ?\e$,1|Z\e(B)
1790 (#x9f0 . ?\e$,1|[\e(B)
6b61353c 1791 (#x9f1 . ?\e$A)$\e(B)
cf07d2bd
DL
1792 (#x9f2 . ?\e$,1|\\e(B)
1793 (#x9f3 . ?\e$,1|]\e(B)
6b61353c
KH
1794 (#x9f4 . ?\e$A)@\e(B)
1795 (#x9f5 . ?\e$A)H\e(B)
1796 (#x9f6 . ?\e$A)X\e(B)
1797 (#x9f7 . ?\e$A)P\e(B)
1798 (#x9f8 . ?\e$A)&\e(B)
cf07d2bd
DL
1799 ;; Publishing
1800 (#xaa1 . ?\e$,1rc\e(B)
1801 (#xaa2 . ?\e$,1rb\e(B)
1802 (#xaa3 . ?\e$,1rd\e(B)
1803 (#xaa4 . ?\e$,1re\e(B)
1804 (#xaa5 . ?\e$,1rg\e(B)
1805 (#xaa6 . ?\e$,1rh\e(B)
1806 (#xaa7 . ?\e$,1ri\e(B)
1807 (#xaa8 . ?\e$,1rj\e(B)
6b61353c
KH
1808 (#xaa9 . ?\e$(G!7\e(B)
1809 (#xaaa . ?\e$(G!9\e(B)
1810 (#xaae . ?\e$A!-\e(B)
1811 (#xaaf . ?\e$(G!-\e(B)
1812 (#xab0 . ?\e$(O'x\e(B)
1813 (#xab1 . ?\e$(O'y\e(B)
1814 (#xab2 . ?\e$(O'z\e(B)
cf07d2bd
DL
1815 (#xab3 . ?\e$,1v6\e(B)
1816 (#xab4 . ?\e$,1v7\e(B)
1817 (#xab5 . ?\e$,1v8\e(B)
1818 (#xab6 . ?\e$,1v9\e(B)
1819 (#xab7 . ?\e$,1v:\e(B)
6b61353c 1820 (#xab8 . ?\e$(G""\e(B)
cf07d2bd
DL
1821 (#xabb . ?\e$,1rr\e(B)
1822 (#xabc . ?\e$,1{)\e(B)
1823 (#xabe . ?\e$,1{*\e(B)
6b61353c
KH
1824 (#xac3 . ?\e$(C({\e(B)
1825 (#xac4 . ?\e$(C(|\e(B)
1826 (#xac5 . ?\e$(C(}\e(B)
1827 (#xac6 . ?\e$(C(~\e(B)
1828 (#xac9 . ?\e$(D"o\e(B)
cf07d2bd 1829 (#xaca . ?\e$,2"s\e(B)
6b61353c
KH
1830 (#xacc . ?\e$(O##\e(B)
1831 (#xacd . ?\e$(O#!\e(B)
1832 (#xace . ?\e$A!p\e(B)
cf07d2bd 1833 (#xacf . ?\e$,2!o\e(B)
6b61353c
KH
1834 (#xad0 . ?\e,F!\e(B)
1835 (#xad1 . ?\e,F"\e(B)
1836 (#xad2 . ?\e,Y4\e(B)
1837 (#xad3 . ?\e,Y!\e(B)
cf07d2bd 1838 (#xad4 . ?\e$,1u^\e(B)
6b61353c
KH
1839 (#xad6 . ?\e$A!d\e(B)
1840 (#xad7 . ?\e$A!e\e(B)
cf07d2bd
DL
1841 (#xad9 . ?\e$,2%]\e(B)
1842 (#xadb . ?\e$,2!l\e(B)
6b61353c
KH
1843 (#xadc . ?\e$(O#$\e(B)
1844 (#xadd . ?\e$(O#"\e(B)
1845 (#xade . ?\e$A!q\e(B)
cf07d2bd 1846 (#xadf . ?\e$,2!n\e(B)
6b61353c 1847 (#xae0 . ?\e$(O#?\e(B)
cf07d2bd
DL
1848 (#xae1 . ?\e$,2!k\e(B)
1849 (#xae2 . ?\e$,2!m\e(B)
6b61353c
KH
1850 (#xae3 . ?\e$A!w\e(B)
1851 (#xae4 . ?\e$(G!}\e(B)
1852 (#xae5 . ?\e$A!n\e(B)
1853 (#xae6 . ?\e$(O#@\e(B)
cf07d2bd 1854 (#xae7 . ?\e$,2!j\e(B)
6b61353c
KH
1855 (#xae8 . ?\e$A!x\e(B)
1856 (#xae9 . ?\e$(G!~\e(B)
1857 (#xaea . ?\e$(C"P\e(B)
1858 (#xaeb . ?\e$(O-~\e(B)
1859 (#xaec . ?\e$(O&@\e(B)
1860 (#xaed . ?\e$(O&<\e(B)
1861 (#xaee . ?\e$(O&>\e(B)
cf07d2bd 1862 (#xaf0 . ?\e$,2%`\e(B)
6b61353c
KH
1863 (#xaf1 . ?\e$B"w\e(B)
1864 (#xaf2 . ?\e$B"x\e(B)
1865 (#xaf3 . ?\e$(O'{\e(B)
cf07d2bd 1866 (#xaf4 . ?\e$,2%W\e(B)
6b61353c
KH
1867 (#xaf5 . ?\e$B"t\e(B)
1868 (#xaf6 . ?\e$B"u\e(B)
1869 (#xaf7 . ?\e$A!a\e(B)
1870 (#xaf8 . ?\e$A!b\e(B)
1871 (#xaf9 . ?\e$(O&g\e(B)
cf07d2bd
DL
1872 (#xafa . ?\e$,1zu\e(B)
1873 (#xafb . ?\e$,1uW\e(B)
1874 (#xafc . ?\e$,1s8\e(B)
1875 (#xafd . ?\e$,1rz\e(B)
6b61353c 1876 (#xafe . ?\e,Y%\e(B)
cf07d2bd
DL
1877 ;; APL
1878 (#xba3 . ?<)
1879 (#xba6 . ?>)
6b61353c
KH
1880 (#xba8 . ?\e$A!E\e(B)
1881 (#xba9 . ?\e$A!D\e(B)
cf07d2bd 1882 (#xbc0 . ?\e,A/\e(B)
6b61353c
KH
1883 (#xbc2 . ?\e$A!M\e(B)
1884 (#xbc3 . ?\e$A!I\e(B)
cf07d2bd
DL
1885 (#xbc4 . ?\e$,1zj\e(B)
1886 (#xbc6 . ?_)
1887 (#xbca . ?\e$,1x8\e(B)
1888 (#xbcc . ?\e$,1|5\e(B)
1889 (#xbce . ?\e$,1yd\e(B)
6b61353c 1890 (#xbcf . ?\e$A!p\e(B)
cf07d2bd 1891 (#xbd3 . ?\e$,1zh\e(B)
6b61353c
KH
1892 (#xbd6 . ?\e$A!H\e(B)
1893 (#xbd8 . ?\e$B"?\e(B)
1894 (#xbda . ?\e$B">\e(B)
cf07d2bd
DL
1895 (#xbdc . ?\e$,1yb\e(B)
1896 (#xbfc . ?\e$,1yc\e(B)
1897 ;; Hebrew
1898 (#xcdf . ?\e,H_\e(B)
1899 (#xce0 . ?\e,H`\e(B)
1900 (#xce1 . ?\e,Ha\e(B)
1901 (#xce2 . ?\e,Hb\e(B)
1902 (#xce3 . ?\e,Hc\e(B)
1903 (#xce4 . ?\e,Hd\e(B)
1904 (#xce5 . ?\e,He\e(B)
1905 (#xce6 . ?\e,Hf\e(B)
1906 (#xce7 . ?\e,Hg\e(B)
1907 (#xce8 . ?\e,Hh\e(B)
1908 (#xce9 . ?\e,Hi\e(B)
1909 (#xcea . ?\e,Hj\e(B)
1910 (#xceb . ?\e,Hk\e(B)
1911 (#xcec . ?\e,Hl\e(B)
1912 (#xced . ?\e,Hm\e(B)
1913 (#xcee . ?\e,Hn\e(B)
1914 (#xcef . ?\e,Ho\e(B)
1915 (#xcf0 . ?\e,Hp\e(B)
1916 (#xcf1 . ?\e,Hq\e(B)
1917 (#xcf2 . ?\e,Hr\e(B)
1918 (#xcf3 . ?\e,Hs\e(B)
1919 (#xcf4 . ?\e,Ht\e(B)
1920 (#xcf5 . ?\e,Hu\e(B)
1921 (#xcf6 . ?\e,Hv\e(B)
1922 (#xcf7 . ?\e,Hw\e(B)
1923 (#xcf8 . ?\e,Hx\e(B)
1924 (#xcf9 . ?\e,Hy\e(B)
1925 (#xcfa . ?\e,Hz\e(B)
1926 ;; Thai
1927 (#xda1 . ?\e,T!\e(B)
1928 (#xda2 . ?\e,T"\e(B)
1929 (#xda3 . ?\e,T#\e(B)
1930 (#xda4 . ?\e,T$\e(B)
1931 (#xda5 . ?\e,T%\e(B)
1932 (#xda6 . ?\e,T&\e(B)
1933 (#xda7 . ?\e,T'\e(B)
1934 (#xda8 . ?\e,T(\e(B)
1935 (#xda9 . ?\e,T)\e(B)
1936 (#xdaa . ?\e,T*\e(B)
1937 (#xdab . ?\e,T+\e(B)
1938 (#xdac . ?\e,T,\e(B)
1939 (#xdad . ?\e,T-\e(B)
1940 (#xdae . ?\e,T.\e(B)
1941 (#xdaf . ?\e,T/\e(B)
1942 (#xdb0 . ?\e,T0\e(B)
1943 (#xdb1 . ?\e,T1\e(B)
1944 (#xdb2 . ?\e,T2\e(B)
1945 (#xdb3 . ?\e,T3\e(B)
1946 (#xdb4 . ?\e,T4\e(B)
1947 (#xdb5 . ?\e,T5\e(B)
1948 (#xdb6 . ?\e,T6\e(B)
1949 (#xdb7 . ?\e,T7\e(B)
1950 (#xdb8 . ?\e,T8\e(B)
1951 (#xdb9 . ?\e,T9\e(B)
1952 (#xdba . ?\e,T:\e(B)
1953 (#xdbb . ?\e,T;\e(B)
1954 (#xdbc . ?\e,T<\e(B)
1955 (#xdbd . ?\e,T=\e(B)
1956 (#xdbe . ?\e,T>\e(B)
1957 (#xdbf . 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(B)
2001 (#xdf1 . ?\e,Tq\e(B)
2002 (#xdf2 . ?\e,Tr\e(B)
2003 (#xdf3 . ?\e,Ts\e(B)
2004 (#xdf4 . ?\e,Tt\e(B)
2005 (#xdf5 . ?\e,Tu\e(B)
2006 (#xdf6 . ?\e,Tv\e(B)
2007 (#xdf7 . ?\e,Tw\e(B)
2008 (#xdf8 . ?\e,Tx\e(B)
2009 (#xdf9 . ?\e,Ty\e(B)
2010 ;; Korean
2011 (#xea1 . ?\e$(C$!\e(B)
2012 (#xea2 . ?\e$(C$"\e(B)
2013 (#xea3 . ?\e$(C$#\e(B)
2014 (#xea4 . ?\e$(C$$\e(B)
2015 (#xea5 . ?\e$(C$%\e(B)
2016 (#xea6 . ?\e$(C$&\e(B)
2017 (#xea7 . ?\e$(C$'\e(B)
2018 (#xea8 . ?\e$(C$(\e(B)
2019 (#xea9 . ?\e$(C$)\e(B)
2020 (#xeaa . ?\e$(C$*\e(B)
2021 (#xeab . ?\e$(C$+\e(B)
2022 (#xeac . ?\e$(C$,\e(B)
2023 (#xead . ?\e$(C$-\e(B)
2024 (#xeae . ?\e$(C$.\e(B)
2025 (#xeaf . ?\e$(C$/\e(B)
2026 (#xeb0 . ?\e$(C$0\e(B)
2027 (#xeb1 . ?\e$(C$1\e(B)
2028 (#xeb2 . ?\e$(C$2\e(B)
2029 (#xeb3 . ?\e$(C$3\e(B)
2030 (#xeb4 . ?\e$(C$4\e(B)
2031 (#xeb5 . ?\e$(C$5\e(B)
2032 (#xeb6 . ?\e$(C$6\e(B)
2033 (#xeb7 . ?\e$(C$7\e(B)
2034 (#xeb8 . ?\e$(C$8\e(B)
2035 (#xeb9 . ?\e$(C$9\e(B)
2036 (#xeba . ?\e$(C$:\e(B)
2037 (#xebb . ?\e$(C$;\e(B)
2038 (#xebc . ?\e$(C$<\e(B)
2039 (#xebd . ?\e$(C$=\e(B)
2040 (#xebe . ?\e$(C$>\e(B)
2041 (#xebf . ?\e$(C$?\e(B)
2042 (#xec0 . ?\e$(C$@\e(B)
2043 (#xec1 . ?\e$(C$A\e(B)
2044 (#xec2 . ?\e$(C$B\e(B)
2045 (#xec3 . ?\e$(C$C\e(B)
2046 (#xec4 . ?\e$(C$D\e(B)
2047 (#xec5 . ?\e$(C$E\e(B)
2048 (#xec6 . ?\e$(C$F\e(B)
2049 (#xec7 . ?\e$(C$G\e(B)
2050 (#xec8 . ?\e$(C$H\e(B)
2051 (#xec9 . ?\e$(C$I\e(B)
2052 (#xeca . ?\e$(C$J\e(B)
2053 (#xecb . ?\e$(C$K\e(B)
2054 (#xecc . ?\e$(C$L\e(B)
2055 (#xecd . ?\e$(C$M\e(B)
2056 (#xece . ?\e$(C$N\e(B)
2057 (#xecf . ?\e$(C$O\e(B)
2058 (#xed0 . ?\e$(C$P\e(B)
2059 (#xed1 . ?\e$(C$Q\e(B)
2060 (#xed2 . ?\e$(C$R\e(B)
2061 (#xed3 . ?\e$(C$S\e(B)
2062 (#xed4 . ?\e$,1LH\e(B)
2063 (#xed5 . ?\e$,1LI\e(B)
2064 (#xed6 . ?\e$,1LJ\e(B)
2065 (#xed7 . ?\e$,1LK\e(B)
2066 (#xed8 . ?\e$,1LL\e(B)
2067 (#xed9 . ?\e$,1LM\e(B)
2068 (#xeda . ?\e$,1LN\e(B)
2069 (#xedb . ?\e$,1LO\e(B)
2070 (#xedc . ?\e$,1LP\e(B)
2071 (#xedd . ?\e$,1LQ\e(B)
2072 (#xede . ?\e$,1LR\e(B)
2073 (#xedf . ?\e$,1LS\e(B)
2074 (#xee0 . ?\e$,1LT\e(B)
2075 (#xee1 . ?\e$,1LU\e(B)
2076 (#xee2 . ?\e$,1LV\e(B)
2077 (#xee3 . ?\e$,1LW\e(B)
2078 (#xee4 . ?\e$,1LX\e(B)
2079 (#xee5 . ?\e$,1LY\e(B)
2080 (#xee6 . ?\e$,1LZ\e(B)
2081 (#xee7 . ?\e$,1L[\e(B)
2082 (#xee8 . ?\e$,1L\\e(B)
2083 (#xee9 . ?\e$,1L]\e(B)
2084 (#xeea . ?\e$,1L^\e(B)
2085 (#xeeb . ?\e$,1L_\e(B)
2086 (#xeec . ?\e$,1L`\e(B)
2087 (#xeed . ?\e$,1La\e(B)
2088 (#xeee . ?\e$,1Lb\e(B)
2089 (#xeef . ?\e$(C$]\e(B)
2090 (#xef0 . ?\e$(C$a\e(B)
2091 (#xef1 . ?\e$(C$h\e(B)
2092 (#xef2 . ?\e$(C$o\e(B)
2093 (#xef3 . ?\e$(C$q\e(B)
2094 (#xef4 . ?\e$(C$t\e(B)
2095 (#xef5 . ?\e$(C$v\e(B)
2096 (#xef6 . ?\e$(C$}\e(B)
2097 (#xef7 . ?\e$(C$~\e(B)
2098 (#xef8 . ?\e$,1M+\e(B)
2099 (#xef9 . ?\e$,1M0\e(B)
2100 (#xefa . ?\e$,1M9\e(B)
2101 (#xeff . ?\e$,1tI\e(B)
2102 ;; Latin-5
2103 ;; Latin-6
2104 ;; Latin-7
2105 ;; Latin-8
2106 ;; Latin-9
2107 (#x13bc . ?\e,b<\e(B)
2108 (#x13bd . ?\e,b=\e(B)
6b61353c 2109 (#x13be . ?\e,_/\e(B)
cf07d2bd
DL
2110 ;; Currency
2111 (#x20a0 . ?\e$,1t@\e(B)
2112 (#x20a1 . ?\e$,1tA\e(B)
2113 (#x20a2 . ?\e$,1tB\e(B)
2114 (#x20a3 . ?\e$,1tC\e(B)
2115 (#x20a4 . ?\e$,1tD\e(B)
2116 (#x20a5 . ?\e$,1tE\e(B)
2117 (#x20a6 . ?\e$,1tF\e(B)
2118 (#x20a7 . ?\e$,1tG\e(B)
2119 (#x20a8 . ?\e$,1tH\e(B)
2120 (#x20aa . ?\e$,1tJ\e(B)
2121 (#x20ab . ?\e$,1tK\e(B)
2122 (#x20ac . ?\e,b$\e(B)))
2123 (puthash (car pair) (cdr pair) x-keysym-table))
2124
2125;; The following keysym codes for graphics are listed in the document
2126;; as not having unicodes available:
2127
2128;; #x08b1 TOP LEFT SUMMATION Technical
2129;; #x08b2 BOTTOM LEFT SUMMATION Technical
2130;; #x08b3 TOP VERTICAL SUMMATION CONNECTOR Technical
2131;; #x08b4 BOTTOM VERTICAL SUMMATION CONNECTOR Technical
2132;; #x08b5 TOP RIGHT SUMMATION Technical
2133;; #x08b6 BOTTOM RIGHT SUMMATION Technical
2134;; #x08b7 RIGHT MIDDLE SUMMATION Technical
2135;; #x0aac SIGNIFICANT BLANK SYMBOL Publish
2136;; #x0abd DECIMAL POINT Publish
2137;; #x0abf MARKER Publish
2138;; #x0acb TRADEMARK SIGN IN CIRCLE Publish
2139;; #x0ada HEXAGRAM Publish
2140;; #x0aff CURSOR Publish
2141;; #x0dde THAI MAIHANAKAT Thai
2142
2fb263f6
JB
2143\f
2144;;;; Selections and cut buffers
67c86cfc 2145
1c7c774b
SM
2146;; We keep track of the last text selected here, so we can check the
2147;; current selection against it, and avoid passing back our own text
2148;; from x-cut-buffer-or-selection-value. We track all three
2149;; seperately in case another X application only sets one of them
2150;; (say the cut buffer) we aren't fooled by the PRIMARY or
2151;; CLIPBOARD selection staying the same.
ae10d597
PJ
2152(defvar x-last-selected-text-clipboard nil
2153 "The value of the CLIPBOARD X selection last time we selected or
2154pasted text.")
089bc712 2155(defvar x-last-selected-text-primary nil
ae10d597
PJ
2156 "The value of the PRIMARY X selection last time we selected or
2157pasted text.")
089bc712 2158(defvar x-last-selected-text-cut nil
eb5ad242
KH
2159 "The value of the X cut buffer last time we selected or pasted text.
2160The actual text stored in the X cut buffer is what encoded from this value.")
2161(defvar x-last-selected-text-cut-encoded nil
2162 "The value of the X cut buffer last time we selected or pasted text.
2163This is the actual text stored in the X cut buffer.")
8eee8101
JD
2164(defvar x-last-cut-buffer-coding 'iso-latin-1
2165 "The coding we last used to encode/decode the text from the X cut buffer")
daa37602 2166
1c7c774b
SM
2167(defvar x-cut-buffer-max 20000 ; Note this value is overridden below.
2168 "Max number of characters to put in the cut buffer.
2169It is said that overlarge strings are slow to put into the cut buffer.")
2666a6a5 2170
d14518d8 2171(defcustom x-select-enable-clipboard nil
dc20df95 2172 "Non-nil means cutting and pasting uses the clipboard.
d14518d8
DL
2173This is in addition to, but in preference to, the primary selection."
2174 :type 'boolean
2175 :group 'killing)
dc20df95 2176
0e2f4e59 2177(defun x-select-text (text &optional push)
1c7c774b
SM
2178 "Make TEXT, a string, the primary X selection.
2179Also, set the value of X cut buffer 0, for backward compatibility
2180with older X applications.
2181gildea@stop.mail-abuse.org says it's not desirable to put kills
2182in the clipboard."
785080c5
RS
2183 ;; Don't send the cut buffer too much text.
2184 ;; It becomes slow, and if really big it causes errors.
ae10d597
PJ
2185 (cond ((>= (length text) x-cut-buffer-max)
2186 (x-set-cut-buffer "" push)
eb5ad242
KH
2187 (setq x-last-selected-text-cut ""
2188 x-last-selected-text-cut-encoded ""))
db95369b 2189 (t
eb5ad242 2190 (setq x-last-selected-text-cut text
8eee8101 2191 x-last-cut-buffer-coding 'iso-latin-1
eb5ad242 2192 x-last-selected-text-cut-encoded
65a0c81b
JD
2193 ;; ICCCM says cut buffer always contain ISO-Latin-1
2194 (encode-coding-string text 'iso-latin-1))
eb5ad242 2195 (x-set-cut-buffer x-last-selected-text-cut-encoded push)))
c8c72d6b 2196 (x-set-selection 'PRIMARY text)
ae10d597
PJ
2197 (setq x-last-selected-text-primary text)
2198 (when x-select-enable-clipboard
99b631c8
KH
2199 (x-set-selection 'CLIPBOARD text)
2200 (setq x-last-selected-text-clipboard text))
ae10d597 2201 )
492878e4 2202
c7d9df18
KH
2203(defvar x-select-request-type nil
2204 "*Data type request for X selection.
2205The value is nil, one of the following data types, or a list of them:
2206 `COMPOUND_TEXT', `UTF8_STRING', `STRING', `TEXT'
2207
2208If the value is nil, try `COMPOUND_TEXT' and `UTF8_STRING', and
2209use the more appropriate result. If both fail, try `STRING', and
2210then `TEXT'.
2211
2212If the value is one of the above symbols, try only the specified
2213type.
2214
2215If the value is a list of them, try each of them in the specified
2216order until succeed.")
2217
2218;; Helper function for x-selection-value. Select UTF8 or CTEXT
2219;; whichever is more appropriate. Here, we use this heurisitcs.
2220;;
2221;; (1) If their lengthes are different, select the longer one. This
2222;; is because an X client may just cut off unsupported characters.
2223;;
a28a315a
KH
2224;; (2) Otherwise, if they are different at Nth character, and that
2225;; of UTF8 is a Latin character and that of CTEXT belongs to a CJK
2226;; character set, select UTF8. Also select UTF8 if the Nth
2227;; character of UTF8 is non-ASCII where as that of CTEXT is ASCII.
2228;; This is because an X client may replace unsupported characters
2229;; with some ASCII character (typically ` ' or `?') in CTEXT.
c7d9df18
KH
2230;;
2231;; (3) Otherwise, select CTEXT. This is because legacy charsets are
2232;; better for the current Emacs, especially when the selection owner
2233;; is also Emacs.
2234
2235(defun x-select-utf8-or-ctext (utf8 ctext)
2236 (let ((len-utf8 (length utf8))
2237 (len-ctext (length ctext))
2238 (selected ctext)
2239 (i 0)
2240 char)
2241 (if (/= len-utf8 len-ctext)
2242 (if (> len-utf8 len-ctext) utf8 ctext)
6b61353c 2243 (let ((result (compare-strings utf8 0 len-utf8 ctext 0 len-ctext)))
a28a315a 2244 (if (eq result t)
6b61353c 2245 ctext
a28a315a
KH
2246 (let ((utf8-char (aref utf8 (1- (abs result))))
2247 (ctext-char (aref ctext (1- (abs result)))))
2248 (if (or (and (aref (char-category-set utf8-char) ?l)
2249 (aref (char-category-set ctext-char) ?C))
2250 (and (>= utf8-char 128)
2251 (< ctext-char 128)))
2252 utf8
2253 ctext)))))))
c7d9df18 2254
d8338794
KH
2255;; Get a selection value of type TYPE by calling x-get-selection with
2256;; an appropiate DATA-TYPE argument decidd by `x-select-request-type'.
2257;; The return value is already decoded. If x-get-selection causes an
2258;; error, this function return nil.
2259
c7d9df18
KH
2260(defun x-selection-value (type)
2261 (let (text)
2262 (cond ((null x-select-request-type)
2263 (let (utf8 ctext utf8-coding)
2264 ;; We try both UTF8_STRING and COMPOUND_TEXT, and choose
2265 ;; the more appropriate one. If both fail, try STRING.
2266
2267 ;; At first try UTF8_STRING.
2268 (setq utf8 (condition-case nil
2269 (x-get-selection type 'UTF8_STRING)
2270 (error nil))
2271 utf8-coding last-coding-system-used)
2272 (if utf8
2e454bb6
KH
2273 ;; If it is a local selection, or it contains only
2274 ;; ASCII characers, choose it.
2275 (if (or (not (get-text-property 0 'foreign-selection utf8))
2276 (= (length utf8) (string-bytes utf8)))
c7d9df18
KH
2277 (setq text utf8)))
2278 ;; If not yet decided, try COMPOUND_TEXT.
2279 (if (not text)
2280 (if (setq ctext (condition-case nil
2281 (x-get-selection type 'COMPOUND_TEXT)
2282 (error nil)))
2283 ;; If UTF8_STRING was also successful, choose the
2284 ;; more appropriate one from UTF8 and CTEXT.
2285 (if utf8
2286 (setq text (x-select-utf8-or-ctext utf8 ctext))
2287 ;; Othewise, choose CTEXT.
c3ff5bc1
KH
2288 (setq text ctext))
2289 (setq text utf8)))
c7d9df18
KH
2290 ;; If not yet decided, try STRING.
2291 (or text
2292 (setq text (condition-case nil
2293 (x-get-selection type 'STRING)
2294 (error nil))))
2295 (if (eq text utf8)
2296 (setq last-coding-system-used utf8-coding))))
2297
2298 ((consp x-select-request-type)
2299 (let ((tail x-select-request-type))
2300 (while (and tail (not text))
2301 (condition-case nil
2302 (setq text (x-get-selection type (car tail)))
2303 (error nil))
2304 (setq tail (cdr tail)))))
2305
2306 (t
2307 (condition-case nil
2308 (setq text (x-get-selection type x-select-request-type))
2309 (error nil))))
2310
2311 (if text
2312 (remove-text-properties 0 (length text) '(foreign-selection nil) text))
2313 text))
5fd6d89f 2314
1c7c774b
SM
2315;; Return the value of the current X selection.
2316;; Consult the selection, and the cut buffer. Treat empty strings
2317;; as if they were unset.
2318;; If this function is called twice and finds the same text,
2319;; it returns nil the second time. This is so that a single
2320;; selection won't be added to the kill ring over and over.
492878e4 2321(defun x-cut-buffer-or-selection-value ()
ae10d597 2322 (let (clip-text primary-text cut-text)
8ba13581 2323 (when x-select-enable-clipboard
c7d9df18 2324 (setq clip-text (x-selection-value 'CLIPBOARD))
ae10d597
PJ
2325 (if (string= clip-text "") (setq clip-text nil))
2326
2327 ;; Check the CLIPBOARD selection for 'newness', is it different
2328 ;; from what we remebered them to be last time we did a
2329 ;; cut/paste operation.
db95369b 2330 (setq clip-text
ae10d597
PJ
2331 (cond;; check clipboard
2332 ((or (not clip-text) (string= clip-text ""))
2333 (setq x-last-selected-text-clipboard nil))
2334 ((eq clip-text x-last-selected-text-clipboard) nil)
2335 ((string= clip-text x-last-selected-text-clipboard)
db95369b 2336 ;; Record the newer string,
ae10d597
PJ
2337 ;; so subsequent calls can use the `eq' test.
2338 (setq x-last-selected-text-clipboard clip-text)
2339 nil)
2340 (t
2341 (setq x-last-selected-text-clipboard clip-text))))
2342 )
8ba13581 2343
c7d9df18 2344 (setq primary-text (x-selection-value 'PRIMARY))
ae10d597
PJ
2345 ;; Check the PRIMARY selection for 'newness', is it different
2346 ;; from what we remebered them to be last time we did a
2347 ;; cut/paste operation.
db95369b 2348 (setq primary-text
ae10d597
PJ
2349 (cond;; check primary selection
2350 ((or (not primary-text) (string= primary-text ""))
2351 (setq x-last-selected-text-primary nil))
2352 ((eq primary-text x-last-selected-text-primary) nil)
2353 ((string= primary-text x-last-selected-text-primary)
db95369b 2354 ;; Record the newer string,
ae10d597
PJ
2355 ;; so subsequent calls can use the `eq' test.
2356 (setq x-last-selected-text-primary primary-text)
2357 nil)
2358 (t
2359 (setq x-last-selected-text-primary primary-text))))
1be7f9b0 2360
ae10d597 2361 (setq cut-text (x-get-cut-buffer 0))
f6c7b4e7 2362
ae10d597
PJ
2363 ;; Check the x cut buffer for 'newness', is it different
2364 ;; from what we remebered them to be last time we did a
2365 ;; cut/paste operation.
db95369b 2366 (setq cut-text
8eee8101
JD
2367 (let ((next-coding (or next-selection-coding-system 'iso-latin-1)))
2368 (cond;; check cut buffer
2369 ((or (not cut-text) (string= cut-text ""))
2370 (setq x-last-selected-text-cut nil))
f6959eb4
JB
2371 ;; This short cut doesn't work because x-get-cut-buffer
2372 ;; always returns a newly created string.
2373 ;; ((eq cut-text x-last-selected-text-cut) nil)
8eee8101
JD
2374 ((and (string= cut-text x-last-selected-text-cut-encoded)
2375 (eq x-last-cut-buffer-coding next-coding))
f6959eb4
JB
2376 ;; See the comment above. No need of this recording.
2377 ;; Record the newer string,
2378 ;; so subsequent calls can use the `eq' test.
2379 ;; (setq x-last-selected-text-cut cut-text)
8eee8101
JD
2380 nil)
2381 (t
2382 (setq x-last-selected-text-cut-encoded cut-text
2383 x-last-cut-buffer-coding next-coding
eb5ad242 2384 x-last-selected-text-cut
ccf17b26
JD
2385 ;; ICCCM says cut buffer always contain ISO-Latin-1, but
2386 ;; use next-selection-coding-system if not nil.
f6959eb4 2387 (decode-coding-string
8eee8101 2388 cut-text next-coding))))))
ae10d597 2389
c7d9df18
KH
2390 ;; As we have done one selection, clear this now.
2391 (setq next-selection-coding-system nil)
2392
ae10d597
PJ
2393 ;; At this point we have recorded the current values for the
2394 ;; selection from clipboard (if we are supposed to) primary,
2395 ;; and cut buffer. So return the first one that has changed
2396 ;; (which is the first non-null one).
2397 ;;
2398 ;; NOTE: There will be cases where more than one of these has
2399 ;; changed and the new values differ. This indicates that
2400 ;; something like the following has happened since the last time
2401 ;; we looked at the selections: Application X set all the
2402 ;; selections, then Application Y set only one or two of them (say
2403 ;; just the cut-buffer). In this case since we don't have
2404 ;; timestamps there is no way to know what the 'correct' value to
2405 ;; return is. The nice thing to do would be to tell the user we
2406 ;; saw multiple possible selections and ask the user which was the
db95369b 2407 ;; one they wanted.
ae10d597
PJ
2408 ;; This code is still a big improvement because now the user can
2409 ;; futz with the current selection and get emacs to pay attention
2410 ;; to the cut buffer again (previously as soon as clipboard or
2411 ;; primary had been set the cut buffer would essentially never be
2412 ;; checked again).
2413 (or clip-text primary-text cut-text)
2414 ))
492878e4 2415
2a36494c
KL
2416(defun x-clipboard-yank ()
2417 "Insert the clipboard contents, or the last stretch of killed text."
3f87f67e 2418 (interactive "*")
ef85512e 2419 (let ((clipboard-text (x-selection-value 'CLIPBOARD))
2a36494c
KL
2420 (x-select-enable-clipboard t))
2421 (if (and clipboard-text (> (length clipboard-text) 0))
2422 (kill-new clipboard-text))
2423 (yank)))
88046be2 2424
12b6af5c
KL
2425(defun x-menu-bar-open (&optional frame)
2426 "Open the menu bar if `menu-bar-mode' is on. otherwise call `tmm-menubar'."
2427 (interactive "i")
5f06b608 2428 (if menu-bar-mode (accelerate-menu frame)
12b6af5c 2429 (tmm-menubar)))
553624bf 2430
2fb263f6 2431\f
e9cda827 2432;;; Window system initialization.
84f1b454 2433
3d80ef3f 2434(defun x-win-suspend-error ()
089bc712 2435 (error "Suspending an Emacs running under X makes no sense"))
c8c72d6b 2436
e9cda827
KL
2437(defvar x-initialized nil
2438 "Non-nil if the X window system has been initialized.")
2439
2440(defun x-initialize-window-system ()
2441 "Initialize Emacs for X frames and open the first connection to an X server."
2442 ;; Make sure we have a valid resource name.
2443 (or (stringp x-resource-name)
2444 (let (i)
2445 (setq x-resource-name (invocation-name))
2446
2447 ;; Change any . or * characters in x-resource-name to hyphens,
2448 ;; so as not to choke when we use it in X resource queries.
2449 (while (setq i (string-match "[.*]" x-resource-name))
2450 (aset x-resource-name i ?-))))
2451
2452 (x-open-connection (or x-display-name
36ab8612 2453 (setq x-display-name (or (getenv "DISPLAY" (selected-frame))
f105f403 2454 (getenv "DISPLAY"))))
e9cda827
KL
2455 x-command-line-resources
2456 ;; Exit Emacs with fatal error if this fails and we
2457 ;; are the initial display.
2458 (eq initial-window-system 'x))
2459
2460 (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
2461 x-cut-buffer-max))
2462
2463 ;; Setup the default fontset.
2464 (setup-default-fontset)
2465
2466 ;; Create the standard fontset.
2467 (create-fontset-from-fontset-spec standard-fontset-spec t)
2468
2469 ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...).
2470 (create-fontset-from-x-resource)
2471
65e86587
KL
2472 ;; Set scroll bar mode to right if set by X resources. Default is left.
2473 (if (equal (x-get-resource "verticalScrollBars" "ScrollBars") "right")
2474 (customize-set-variable 'scroll-bar-mode 'right))
2475
e9cda827
KL
2476 ;; Apply a geometry resource to the initial frame. Put it at the end
2477 ;; of the alist, so that anything specified on the command line takes
2478 ;; precedence.
2479 (let* ((res-geometry (x-get-resource "geometry" "Geometry"))
2480 parsed)
2481 (if res-geometry
2482 (progn
2483 (setq parsed (x-parse-geometry res-geometry))
2484 ;; If the resource specifies a position,
2485 ;; call the position and size "user-specified".
2486 (if (or (assq 'top parsed) (assq 'left parsed))
2487 (setq parsed (cons '(user-position . t)
2488 (cons '(user-size . t) parsed))))
2489 ;; All geometry parms apply to the initial frame.
2490 (setq initial-frame-alist (append initial-frame-alist parsed))
f6959eb4 2491 ;; The size parms apply to all frames. Don't set it if there are
14bcc1e0
KL
2492 ;; sizes there already (from command line).
2493 (if (and (assq 'height parsed)
2494 (not (assq 'height default-frame-alist)))
e9cda827
KL
2495 (setq default-frame-alist
2496 (cons (cons 'height (cdr (assq 'height parsed)))
2497 default-frame-alist)))
14bcc1e0
KL
2498 (if (and (assq 'width parsed)
2499 (not (assq 'width default-frame-alist)))
e9cda827
KL
2500 (setq default-frame-alist
2501 (cons (cons 'width (cdr (assq 'width parsed)))
2502 default-frame-alist))))))
2503
2504 ;; Check the reverseVideo resource.
2505 (let ((case-fold-search t))
2506 (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
2507 (if (and rv
2508 (string-match "^\\(true\\|yes\\|on\\)$" rv))
2509 (setq default-frame-alist
2510 (cons '(reverse . t) default-frame-alist)))))
63c86e17 2511
e9cda827
KL
2512 ;; Set x-selection-timeout, measured in milliseconds.
2513 (let ((res-selection-timeout
2514 (x-get-resource "selectionTimeout" "SelectionTimeout")))
2515 (setq x-selection-timeout 20000)
2516 (if res-selection-timeout
2517 (setq x-selection-timeout (string-to-number res-selection-timeout))))
5cdb3f1e 2518
0b0d3e0b 2519 ;; Don't let Emacs suspend under X.
e9cda827 2520 (add-hook 'suspend-hook 'x-win-suspend-error)
53631723 2521
e9cda827
KL
2522 ;; Turn off window-splitting optimization; X is usually fast enough
2523 ;; that this is only annoying.
2524 (setq split-window-keep-point t)
c3ef5084 2525
e9cda827
KL
2526 ;; Motif direct handling of f10 wasn't working right,
2527 ;; So temporarily we've turned it off in lwlib-Xm.c
2528 ;; and turned the Emacs f10 back on.
2529 ;; ;; Motif normally handles f10 itself, so don't try to handle it a second time.
2530 ;; (if (featurep 'motif)
2531 ;; (global-set-key [f10] 'ignore))
9541a441 2532
e9cda827
KL
2533 ;; Turn on support for mouse wheels.
2534 (mouse-wheel-mode 1)
6b61353c 2535
2a36494c
KL
2536 ;; Enable CLIPBOARD copy/paste through menu bar commands.
2537 (menu-bar-enable-clipboard)
6b61353c 2538
2a36494c
KL
2539 ;; Override Paste so it looks at CLIPBOARD first.
2540 (define-key menu-bar-edit-menu [paste]
5665a02f
KL
2541 (append '(menu-item "Paste" x-clipboard-yank
2542 :enable (not buffer-read-only)
2543 :help "Paste (yank) text most recently cut/copied")
2544 nil))
6b61353c 2545
e9cda827 2546 (setq x-initialized t))
c3ef5084 2547
e9cda827
KL
2548(add-to-list 'handle-args-function-alist '(x . x-handle-args))
2549(add-to-list 'frame-creation-function-alist '(x . x-create-frame-with-faces))
2550(add-to-list 'window-system-initialization-alist '(x . x-initialize-window-system))
6b61353c
KH
2551
2552;; Initiate drag and drop
2553(add-hook 'after-make-frame-functions 'x-dnd-init-frame)
c0acb3ee 2554(define-key special-event-map [drag-n-drop] 'x-dnd-handle-drag-n-drop-event)
6b61353c 2555
dd314751
JD
2556(defcustom x-gtk-stock-map
2557 '(
5cb94d12
JD
2558 ("etc/images/new" . "gtk-new")
2559 ("etc/images/open" . "gtk-open")
5db55b9e 2560 ("etc/images/diropen" . "n:system-file-manager")
5cb94d12
JD
2561 ("etc/images/close" . "gtk-close")
2562 ("etc/images/save" . "gtk-save")
2563 ("etc/images/saveas" . "gtk-save-as")
2564 ("etc/images/undo" . "gtk-undo")
2565 ("etc/images/cut" . "gtk-cut")
2566 ("etc/images/copy" . "gtk-copy")
2567 ("etc/images/paste" . "gtk-paste")
2568 ("etc/images/search" . "gtk-find")
2569 ("etc/images/print" . "gtk-print")
2570 ("etc/images/preferences" . "gtk-preferences")
2571 ("etc/images/help" . "gtk-help")
2572 ("etc/images/left-arrow" . "gtk-go-back")
2573 ("etc/images/right-arrow" . "gtk-go-forward")
2574 ("etc/images/home" . "gtk-home")
2575 ("etc/images/jump-to" . "gtk-jump-to")
2576 ("etc/images/index" . "gtk-index")
2577 ("etc/images/search" . "gtk-find")
2e55c986
RS
2578 ("etc/images/exit" . "gtk-quit")
2579 ;; Used in Gnus and/or MH-E:
2580 ("etc/images/attach.xpm" . "gtk-attach")
2581 ("etc/images/connect.xpm" . "gtk-connect")
2582 ("etc/images/contact.xpm" . "gtk-contact")
2583 ("etc/images/delete.xpm" . "gtk-delete")
2584 ("etc/images/describe.xpm" . "gtk-properties")
2585 ("etc/images/disconnect.xpm" . "gtk-disconnect")
2586 ;; ("etc/images/exit.xpm" . "gtk-exit")
2587 ("etc/images/lock-broken.xpm" . "gtk-lock_broken")
2588 ("etc/images/lock-ok.xpm" . "gtk-lock_ok")
2589 ("etc/images/lock.xpm" . "gtk-lock")
2590 ("etc/images/next-page.xpm" . "gtk-next-page")
2591 ("etc/images/refresh.xpm" . "gtk-refresh")
2592 ("etc/images/sort-ascending.xpm" . "gtk-sort-ascending")
2593 ("etc/images/sort-column-ascending.xpm" . "gtk-sort-column-ascending")
2594 ("etc/images/sort-criteria.xpm" . "gtk-sort-criteria")
2595 ("etc/images/sort-descending.xpm" . "gtk-sort-descending")
2596 ("etc/images/sort-row-ascending.xpm" . "gtk-sort-row-ascending")
2597 ("images/gnus/toggle-subscription.xpm" . "gtk-task-recurring")
2598 ("images/mail/compose.xpm" . "gtk-mail-compose")
2599 ("images/mail/copy.xpm" . "gtk-mail-copy")
2600 ("images/mail/forward.xpm" . "gtk-mail-forward")
2601 ("images/mail/inbox.xpm" . "gtk-inbox")
2602 ("images/mail/move.xpm" . "gtk-mail-move")
2603 ("images/mail/not-spam.xpm" . "gtk-not-spam")
2604 ("images/mail/outbox.xpm" . "gtk-outbox")
2605 ("images/mail/reply-all.xpm" . "gtk-mail-reply-to-all")
2606 ("images/mail/reply.xpm" . "gtk-mail-reply")
2607 ("images/mail/save-draft.xpm" . "gtk-mail-handling")
2608 ("images/mail/send.xpm" . "gtk-mail-send")
2609 ("images/mail/spam.xpm" . "gtk-spam")
2610 ;; No themed versions available:
2611 ;; mail/preview.xpm (combining stock_mail and stock_zoom)
2612 ;; mail/save.xpm (combining stock_mail, stock_save and stock_convert)
2613 )
dd314751 2614 "How icons for tool bars are mapped to Gtk+ stock items.
5db55b9e
JD
2615Emacs must be compiled with the Gtk+ toolkit for this to have any effect.
2616A value that begins with n: denotes a named icon instead of a stock icon."
7fbe8079 2617 :version "22.2"
2e55c986
RS
2618 :type '(choice (repeat (choice symbol
2619 (cons (string :tag "Emacs icon")
2620 (string :tag "Stock/named")))))
dd314751
JD
2621 :group 'x)
2622
2e55c986
RS
2623(defcustom icon-map-list '(x-gtk-stock-map)
2624 "A list of alists that maps icon file names to stock/named icons.
5db55b9e
JD
2625The alists are searched in the order they appear. The first match is used.
2626The keys in the alists are file names without extension and with two directory
2627components. For example, to map /usr/share/emacs/22.1.1/etc/images/open.xpm
2628to stock item gtk-open, use:
2629
2630 (\"etc/images/open\" . \"gtk-open\")
2631
2632Themes also have named icons. To map to one of those, use n: before the name:
2633
2634 (\"etc/images/diropen\" . \"n:system-file-manager\")
2635
2e55c986
RS
2636The list elements are either the symbol name for the alist or the
2637alist itself.
2638
2639If you don't want stock icons, set the variable to nil."
2640 :version "22.2"
2641 :type '(choice (const :tag "Don't use stock icons" nil)
2642 (repeat (choice symbol
2643 (cons (string :tag "Emacs icon")
2644 (string :tag "Stock/named")))))
2645 :group 'x)
5db55b9e 2646
dd314751 2647(defun x-gtk-map-stock (file)
017de784 2648 "Map icon with file name FILE to a Gtk+ stock name, using `x-gtk-stock-map'."
5cb94d12
JD
2649 (let* ((file-sans (file-name-sans-extension file))
2650 (key (and (string-match "/\\([^/]+/[^/]+/[^/]+$\\)" file-sans)
2651 (match-string 1 file-sans)))
5db55b9e
JD
2652 (value))
2653 (mapc (lambda (elem)
2654 (let ((assoc (if (symbolp elem) (symbol-value elem) elem)))
2655 (or value (setq value (assoc-string (or key file-sans) assoc)))))
2656 icon-map-list)
dd314751
JD
2657 (and value (cdr value))))
2658
7c1bfecc 2659(provide 'x-win)
e380957e 2660
dd314751
JD
2661(defcustom x-gtk-stock-map
2662 '(
4b59f2d8
JD
2663 ("etc/images/new" . "gtk-new")
2664 ("etc/images/open" . "gtk-open")
2665 ("etc/images/diropen" . "n:system-file-manager")
2666 ("etc/images/close" . "gtk-close")
2667 ("etc/images/save" . "gtk-save")
2668 ("etc/images/saveas" . "gtk-save-as")
2669 ("etc/images/undo" . "gtk-undo")
2670 ("etc/images/cut" . "gtk-cut")
2671 ("etc/images/copy" . "gtk-copy")
2672 ("etc/images/paste" . "gtk-paste")
2673 ("etc/images/search" . "gtk-find")
2674 ("etc/images/print" . "gtk-print")
2675 ("etc/images/preferences" . "gtk-preferences")
2676 ("etc/images/help" . "gtk-help")
2677 ("etc/images/left-arrow" . "gtk-go-back")
2678 ("etc/images/right-arrow" . "gtk-go-forward")
2679 ("etc/images/home" . "gtk-home")
2680 ("etc/images/jump-to" . "gtk-jump-to")
2681 ("etc/images/index" . "gtk-index")
2682 ("etc/images/search" . "gtk-find")
2683 ("etc/images/exit" . "gtk-quit"))
dd314751 2684 "How icons for tool bars are mapped to Gtk+ stock items.
4b59f2d8
JD
2685Emacs must be compiled with the Gtk+ toolkit for this to have any effect.
2686A value that begins with n: denotes a named icon instead of a stock icon."
f7d4d4df 2687 :version "22.2"
dd314751
JD
2688 :type 'alist
2689 :group 'x)
2690
1f09f6e8 2691(defvar icon-map-list nil
4b59f2d8
JD
2692 "*A list of alists that maps icon file names to stock/named icons.
2693The alists are searched in the order they appear. The first match is used.
2694The keys in the alists are file names without extension and with two directory
2695components. For example, to map /usr/share/emacs/22.1.1/etc/images/open.xpm
2696to stock item gtk-open, use:
2697
2698 (\"etc/images/open\" . \"gtk-open\")
2699
2700Themes also have named icons. To map to one of those, use n: before the name:
2701
2702 (\"etc/images/diropen\" . \"n:system-file-manager\")
2703
2704The list elements are either the symbol name for the alist or the alist itself.")
2705
dd314751 2706(defun x-gtk-map-stock (file)
017de784 2707 "Map icon with file name FILE to a Gtk+ stock name, using `x-gtk-stock-map'."
4b59f2d8
JD
2708 (let* ((file-sans (file-name-sans-extension file))
2709 (key (and (string-match "/\\([^/]+/[^/]+/[^/]+$\\)" file-sans)
2710 (match-string 1 file-sans)))
2711 (value))
2712 (mapc (lambda (elem)
2713 (let ((assoc (if (symbolp elem) (symbol-value elem) elem)))
2714 (or value (setq value (assoc-string (or key file-sans) assoc)))))
2715 icon-map-list)
dd314751
JD
2716 (and value (cdr value))))
2717
1c7c774b 2718;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78
5cdb3f1e 2719;;; x-win.el ends here