New file.
[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
TTN
3;; Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004,
4;; 2005 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
13;; the Free Software Foundation; either version 2, or (at your option)
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
JB
27
28;; X-win.el: this file is loaded from ../lisp/startup.el when it recognizes
29;; that X windows are to be used. Command line switches are parsed and those
30;; pertaining to X are processed and removed from the command line. The
31;; X display is opened and hooks are set for popping up the initial window.
32
33;; startup.el will then examine startup files, and eventually call the hooks
cf07d2bd 34;; which create the first window(s).
5cdb3f1e
ER
35
36;;; Code:
63f77899
JB
37\f
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
db176f55
JB
57;; -i .iconType
58;; -itype .iconType
63f77899
JB
59;; -iconic .iconic
60;; -name .name
61;; -reverse *reverseVideo
62;; -rv *reverseVideo
63;; -selectionTimeout .selectionTimeout
64;; -synchronous *synchronous
63f77899
JB
65;; -xrm
66
63f77899
JB
67;; An alist of X options and the function which handles them. See
68;; ../startup.el.
69
63c86e17 70(if (not (eq window-system 'x))
800642d2 71 (error "%s: Loading x-win.el but not compiled for X" (invocation-name)))
db95369b 72
0cc89026 73(require 'frame)
3eb43f71 74(require 'mouse)
b16795eb 75(require 'scroll-bar)
ffe1dd7a
JB
76(require 'faces)
77(require 'select)
290cb602 78(require 'menu-bar)
6acdd93e 79(require 'fontset)
133aad74 80(require 'x-dnd)
63c86e17 81
19b08de9 82(defvar x-invocation-args)
cc5e32c5
JB
83(defvar x-keysym-table)
84(defvar x-selection-timeout)
85(defvar x-session-id)
86(defvar x-session-previous-id)
19b08de9 87
f6f6d98c
RS
88(defvar x-command-line-resources nil)
89
63f77899
JB
90;; Handler for switches of the form "-switch value" or "-switch".
91(defun x-handle-switch (switch)
80128ceb 92 (let ((aelt (assoc switch command-line-x-option-alist)))
63f77899 93 (if aelt
80128ceb
RS
94 (let ((param (nth 3 aelt))
95 (value (nth 4 aelt)))
96 (if value
97 (setq default-frame-alist
98 (cons (cons param value)
99 default-frame-alist))
0cc89026 100 (setq default-frame-alist
80128ceb
RS
101 (cons (cons param
102 (car x-invocation-args))
103 default-frame-alist)
104 x-invocation-args (cdr x-invocation-args)))))))
105
106;; Handler for switches of the form "-switch n"
107(defun x-handle-numeric-switch (switch)
108 (let ((aelt (assoc switch command-line-x-option-alist)))
109 (if aelt
110 (let ((param (nth 3 aelt)))
0cc89026 111 (setq default-frame-alist
80128ceb 112 (cons (cons param
027a4b6b 113 (string-to-number (car x-invocation-args)))
0cc89026 114 default-frame-alist)
80128ceb
RS
115 x-invocation-args
116 (cdr x-invocation-args))))))
63f77899 117
2f9b363a
EZ
118;; Handle options that apply to initial frame only
119(defun x-handle-initial-switch (switch)
120 (let ((aelt (assoc switch command-line-x-option-alist)))
121 (if aelt
122 (let ((param (nth 3 aelt))
123 (value (nth 4 aelt)))
124 (if value
125 (setq initial-frame-alist
126 (cons (cons param value)
127 initial-frame-alist))
128 (setq initial-frame-alist
129 (cons (cons param
130 (car x-invocation-args))
131 initial-frame-alist)
132 x-invocation-args (cdr x-invocation-args)))))))
133
ef599142
RS
134;; Make -iconic apply only to the initial frame!
135(defun x-handle-iconic (switch)
136 (setq initial-frame-alist
137 (cons '(visibility . icon) initial-frame-alist)))
138
800642d2
JB
139;; Handle the -xrm option.
140(defun x-handle-xrm-switch (switch)
2025ddca
GM
141 (unless (consp x-invocation-args)
142 (error "%s: missing argument to `%s' option" (invocation-name) switch))
143 (setq x-command-line-resources
144 (if (null x-command-line-resources)
145 (car x-invocation-args)
146 (concat x-command-line-resources "\n" (car x-invocation-args))))
f6f6d98c
RS
147 (setq x-invocation-args (cdr x-invocation-args)))
148
63f77899
JB
149;; Handle the geometry option
150(defun x-handle-geometry (switch)
ea8d3061
RS
151 (let* ((geo (x-parse-geometry (car x-invocation-args)))
152 (left (assq 'left geo))
153 (top (assq 'top geo))
154 (height (assq 'height geo))
155 (width (assq 'width geo)))
156 (if (or height width)
157 (setq default-frame-alist
158 (append default-frame-alist
bfabe882
RS
159 '((user-size . t))
160 (if height (list height))
161 (if width (list width)))
162 initial-frame-alist
163 (append initial-frame-alist
ea8d3061
RS
164 '((user-size . t))
165 (if height (list height))
166 (if width (list width)))))
167 (if (or left top)
168 (setq initial-frame-alist
169 (append initial-frame-alist
170 '((user-position . t))
171 (if left (list left))
172 (if top (list top)))))
173 (setq x-invocation-args (cdr x-invocation-args))))
63f77899 174
66f229be
RS
175;; Handle the -name option. Set the variable x-resource-name
176;; to the option's operand; set the name of
800642d2 177;; the initial frame, too.
66f229be 178(defun x-handle-name-switch (switch)
800642d2
JB
179 (or (consp x-invocation-args)
180 (error "%s: missing argument to `%s' option" (invocation-name) switch))
181 (setq x-resource-name (car x-invocation-args)
182 x-invocation-args (cdr x-invocation-args))
66f229be
RS
183 (setq initial-frame-alist (cons (cons 'name x-resource-name)
184 initial-frame-alist)))
800642d2 185
63f77899 186(defvar x-display-name nil
0cc89026 187 "The X display name specifying server and X frame.")
63f77899
JB
188
189(defun x-handle-display (switch)
190 (setq x-display-name (car x-invocation-args)
d98f0b87
RS
191 x-invocation-args (cdr x-invocation-args))
192 ;; Make subshell programs see the same DISPLAY value Emacs really uses.
193 ;; Note that this isn't completely correct, since Emacs can use
194 ;; multiple displays. However, there is no way to tell an already
195 ;; running subshell which display the user is currently typing on.
196 (setenv "DISPLAY" x-display-name))
63f77899 197
8769d648 198(defun x-handle-args (args)
dc20df95
RS
199 "Process the X-related command line options in ARGS.
200This is done before the user's startup file is loaded. They are copied to
80128ceb 201`x-invocation-args', from which the X-related things are extracted, first
8769d648 202the switch (e.g., \"-fg\") in the following code, and possible values
a4e104bf 203\(e.g., \"black\") in the option handler code (e.g., x-handle-switch).
80128ceb
RS
204This function returns ARGS minus the arguments that have been processed."
205 ;; We use ARGS to accumulate the args that we don't handle here, to return.
63c86e17
JB
206 (setq x-invocation-args args
207 args nil)
0dd96d4c
RS
208 (while (and x-invocation-args
209 (not (equal (car x-invocation-args) "--")))
63c86e17 210 (let* ((this-switch (car x-invocation-args))
e491912f 211 (orig-this-switch this-switch)
80128ceb 212 completion argval aelt handler)
63c86e17 213 (setq x-invocation-args (cdr x-invocation-args))
e491912f
RS
214 ;; Check for long options with attached arguments
215 ;; and separate out the attached option argument into argval.
216 (if (string-match "^--[^=]*=" this-switch)
217 (setq argval (substring this-switch (match-end 0))
218 this-switch (substring this-switch 0 (1- (match-end 0)))))
80128ceb
RS
219 ;; Complete names of long options.
220 (if (string-match "^--" this-switch)
221 (progn
222 (setq completion (try-completion this-switch command-line-x-option-alist))
223 (if (eq completion t)
224 ;; Exact match for long option.
225 nil
226 (if (stringp completion)
227 (let ((elt (assoc completion command-line-x-option-alist)))
228 ;; Check for abbreviated long option.
229 (or elt
230 (error "Option `%s' is ambiguous" this-switch))
231 (setq this-switch completion))))))
232 (setq aelt (assoc this-switch command-line-x-option-alist))
233 (if aelt (setq handler (nth 2 aelt)))
234 (if handler
e491912f
RS
235 (if argval
236 (let ((x-invocation-args
237 (cons argval x-invocation-args)))
80128ceb
RS
238 (funcall handler this-switch))
239 (funcall handler this-switch))
240 (setq args (cons orig-this-switch args)))))
0dd96d4c 241 (nconc (nreverse args) x-invocation-args))
941a391a
JD
242
243;; Handle the --smid switch. This is used by the session manager
244;; to give us back our session id we had on the previous run.
245(defun x-handle-smid (switch)
246 (or (consp x-invocation-args)
247 (error "%s: missing argument to `%s' option" (invocation-name) switch))
248 (setq x-session-previous-id (car x-invocation-args)
249 x-invocation-args (cdr x-invocation-args)))
250
251(defvar emacs-save-session-functions nil
c3ef5084
SM
252 "Special hook run when a save-session event occurs.
253The functions do not get any argument.
941a391a
JD
254Functions can return non-nil to inform the session manager that the
255window system shutdown should be aborted.
256
257See also `emacs-session-save'.")
258
259(defun emacs-session-filename (session-id)
260 "Construct a filename to save the session in based on SESSION-ID.
261If the directory ~/.emacs.d exists, we make a filename in there, otherwise
262a file in the home directory."
263 (let ((basename (concat "session." session-id))
264 (emacs-dir "~/.emacs.d/"))
265 (expand-file-name (if (file-directory-p emacs-dir)
266 (concat emacs-dir basename)
267 (concat "~/.emacs-" basename)))))
db95369b 268
941a391a
JD
269(defun emacs-session-save ()
270 "This function is called when the window system is shutting down.
271If this function returns non-nil, the window system shutdown is cancelled.
272
273When a session manager tells Emacs that the window system is shutting
274down, this function is called. It calls the functions in the hook
275`emacs-save-session-functions'. Functions are called with the current
276buffer set to a temporary buffer. Functions should use `insert' to insert
277lisp code to save the session state. The buffer is saved
278in a file in the home directory of the user running Emacs. The file
279is evaluated when Emacs is restarted by the session manager.
280
281If any of the functions returns non-nil, no more functions are called
282and this function returns non-nil. This will inform the session manager
283that it should abort the window system shutdown."
284 (let ((filename (emacs-session-filename x-session-id))
285 (buf (get-buffer-create (concat " *SES " x-session-id))))
286 (when (file-exists-p filename)
287 (delete-file filename))
288 (with-current-buffer buf
289 (let ((cancel-shutdown (condition-case nil
3842fde1 290 ;; A return of t means cancel the shutdown.
db95369b 291 (run-hook-with-args-until-success
941a391a
JD
292 'emacs-save-session-functions)
293 (error t))))
294 (unless cancel-shutdown
295 (write-file filename))
296 (kill-buffer buf)
297 cancel-shutdown))))
298
1e4f6cec 299(defun emacs-session-restore (previous-session-id)
941a391a
JD
300 "Restore the Emacs session if started by a session manager.
301The file saved by `emacs-session-save' is evaluated and deleted if it
302exists."
1e4f6cec 303 (let ((filename (emacs-session-filename previous-session-id)))
941a391a
JD
304 (when (file-exists-p filename)
305 (load-file filename)
306 (delete-file filename)
307 (message "Restored session data"))))
308
db95369b
JB
309
310
63f77899
JB
311\f
312;;
313;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them.
314;;
315
316(defconst x-pointer-X-cursor 0)
317(defconst x-pointer-arrow 2)
318(defconst x-pointer-based-arrow-down 4)
319(defconst x-pointer-based-arrow-up 6)
320(defconst x-pointer-boat 8)
321(defconst x-pointer-bogosity 10)
322(defconst x-pointer-bottom-left-corner 12)
323(defconst x-pointer-bottom-right-corner 14)
324(defconst x-pointer-bottom-side 16)
325(defconst x-pointer-bottom-tee 18)
326(defconst x-pointer-box-spiral 20)
327(defconst x-pointer-center-ptr 22)
328(defconst x-pointer-circle 24)
329(defconst x-pointer-clock 26)
330(defconst x-pointer-coffee-mug 28)
331(defconst x-pointer-cross 30)
332(defconst x-pointer-cross-reverse 32)
333(defconst x-pointer-crosshair 34)
334(defconst x-pointer-diamond-cross 36)
335(defconst x-pointer-dot 38)
336(defconst x-pointer-dotbox 40)
337(defconst x-pointer-double-arrow 42)
338(defconst x-pointer-draft-large 44)
339(defconst x-pointer-draft-small 46)
340(defconst x-pointer-draped-box 48)
341(defconst x-pointer-exchange 50)
342(defconst x-pointer-fleur 52)
343(defconst x-pointer-gobbler 54)
344(defconst x-pointer-gumby 56)
345(defconst x-pointer-hand1 58)
346(defconst x-pointer-hand2 60)
347(defconst x-pointer-heart 62)
348(defconst x-pointer-icon 64)
349(defconst x-pointer-iron-cross 66)
350(defconst x-pointer-left-ptr 68)
351(defconst x-pointer-left-side 70)
352(defconst x-pointer-left-tee 72)
353(defconst x-pointer-leftbutton 74)
354(defconst x-pointer-ll-angle 76)
355(defconst x-pointer-lr-angle 78)
356(defconst x-pointer-man 80)
357(defconst x-pointer-middlebutton 82)
358(defconst x-pointer-mouse 84)
359(defconst x-pointer-pencil 86)
360(defconst x-pointer-pirate 88)
361(defconst x-pointer-plus 90)
362(defconst x-pointer-question-arrow 92)
363(defconst x-pointer-right-ptr 94)
364(defconst x-pointer-right-side 96)
365(defconst x-pointer-right-tee 98)
366(defconst x-pointer-rightbutton 100)
367(defconst x-pointer-rtl-logo 102)
368(defconst x-pointer-sailboat 104)
369(defconst x-pointer-sb-down-arrow 106)
370(defconst x-pointer-sb-h-double-arrow 108)
371(defconst x-pointer-sb-left-arrow 110)
372(defconst x-pointer-sb-right-arrow 112)
373(defconst x-pointer-sb-up-arrow 114)
374(defconst x-pointer-sb-v-double-arrow 116)
375(defconst x-pointer-shuttle 118)
376(defconst x-pointer-sizing 120)
377(defconst x-pointer-spider 122)
378(defconst x-pointer-spraycan 124)
379(defconst x-pointer-star 126)
380(defconst x-pointer-target 128)
381(defconst x-pointer-tcross 130)
382(defconst x-pointer-top-left-arrow 132)
383(defconst x-pointer-top-left-corner 134)
384(defconst x-pointer-top-right-corner 136)
385(defconst x-pointer-top-side 138)
386(defconst x-pointer-top-tee 140)
387(defconst x-pointer-trek 142)
388(defconst x-pointer-ul-angle 144)
389(defconst x-pointer-umbrella 146)
390(defconst x-pointer-ur-angle 148)
391(defconst x-pointer-watch 150)
392(defconst x-pointer-xterm 152)
393\f
394;;
395;; Available colors
396;;
397
38fb1ad4
GM
398(defvar x-colors '("LightGreen"
399 "light green"
400 "DarkRed"
401 "dark red"
402 "DarkMagenta"
403 "dark magenta"
404 "DarkCyan"
405 "dark cyan"
406 "DarkBlue"
407 "dark blue"
408 "DarkGray"
409 "dark gray"
410 "DarkGrey"
411 "dark grey"
412 "grey100"
413 "gray100"
414 "grey99"
415 "gray99"
416 "grey98"
417 "gray98"
418 "grey97"
419 "gray97"
420 "grey96"
421 "gray96"
422 "grey95"
423 "gray95"
424 "grey94"
425 "gray94"
426 "grey93"
427 "gray93"
428 "grey92"
429 "gray92"
430 "grey91"
431 "gray91"
432 "grey90"
433 "gray90"
434 "grey89"
435 "gray89"
436 "grey88"
437 "gray88"
438 "grey87"
439 "gray87"
440 "grey86"
441 "gray86"
442 "grey85"
443 "gray85"
444 "grey84"
445 "gray84"
446 "grey83"
447 "gray83"
448 "grey82"
449 "gray82"
450 "grey81"
451 "gray81"
452 "grey80"
453 "gray80"
454 "grey79"
455 "gray79"
456 "grey78"
457 "gray78"
458 "grey77"
459 "gray77"
460 "grey76"
461 "gray76"
462 "grey75"
463 "gray75"
464 "grey74"
465 "gray74"
466 "grey73"
467 "gray73"
468 "grey72"
469 "gray72"
470 "grey71"
471 "gray71"
472 "grey70"
473 "gray70"
474 "grey69"
475 "gray69"
476 "grey68"
477 "gray68"
478 "grey67"
479 "gray67"
480 "grey66"
481 "gray66"
482 "grey65"
483 "gray65"
484 "grey64"
485 "gray64"
486 "grey63"
487 "gray63"
488 "grey62"
489 "gray62"
490 "grey61"
491 "gray61"
492 "grey60"
493 "gray60"
494 "grey59"
495 "gray59"
496 "grey58"
497 "gray58"
498 "grey57"
499 "gray57"
500 "grey56"
501 "gray56"
502 "grey55"
503 "gray55"
504 "grey54"
505 "gray54"
506 "grey53"
507 "gray53"
508 "grey52"
509 "gray52"
510 "grey51"
511 "gray51"
512 "grey50"
513 "gray50"
514 "grey49"
515 "gray49"
516 "grey48"
517 "gray48"
518 "grey47"
519 "gray47"
520 "grey46"
521 "gray46"
522 "grey45"
523 "gray45"
524 "grey44"
525 "gray44"
526 "grey43"
527 "gray43"
528 "grey42"
529 "gray42"
530 "grey41"
531 "gray41"
532 "grey40"
533 "gray40"
534 "grey39"
535 "gray39"
536 "grey38"
537 "gray38"
538 "grey37"
539 "gray37"
540 "grey36"
541 "gray36"
542 "grey35"
543 "gray35"
544 "grey34"
545 "gray34"
546 "grey33"
547 "gray33"
548 "grey32"
549 "gray32"
550 "grey31"
551 "gray31"
552 "grey30"
553 "gray30"
554 "grey29"
555 "gray29"
556 "grey28"
557 "gray28"
558 "grey27"
559 "gray27"
560 "grey26"
561 "gray26"
562 "grey25"
563 "gray25"
564 "grey24"
565 "gray24"
566 "grey23"
567 "gray23"
568 "grey22"
569 "gray22"
570 "grey21"
571 "gray21"
572 "grey20"
573 "gray20"
574 "grey19"
575 "gray19"
576 "grey18"
577 "gray18"
578 "grey17"
579 "gray17"
580 "grey16"
581 "gray16"
582 "grey15"
583 "gray15"
584 "grey14"
585 "gray14"
586 "grey13"
587 "gray13"
588 "grey12"
589 "gray12"
590 "grey11"
591 "gray11"
592 "grey10"
593 "gray10"
594 "grey9"
595 "gray9"
596 "grey8"
597 "gray8"
598 "grey7"
599 "gray7"
600 "grey6"
601 "gray6"
602 "grey5"
603 "gray5"
604 "grey4"
605 "gray4"
606 "grey3"
607 "gray3"
608 "grey2"
609 "gray2"
610 "grey1"
611 "gray1"
612 "grey0"
613 "gray0"
614 "thistle4"
615 "thistle3"
616 "thistle2"
617 "thistle1"
618 "MediumPurple4"
619 "MediumPurple3"
620 "MediumPurple2"
621 "MediumPurple1"
622 "purple4"
623 "purple3"
624 "purple2"
625 "purple1"
626 "DarkOrchid4"
627 "DarkOrchid3"
628 "DarkOrchid2"
629 "DarkOrchid1"
630 "MediumOrchid4"
631 "MediumOrchid3"
632 "MediumOrchid2"
633 "MediumOrchid1"
634 "plum4"
635 "plum3"
636 "plum2"
637 "plum1"
638 "orchid4"
639 "orchid3"
640 "orchid2"
641 "orchid1"
642 "magenta4"
643 "magenta3"
644 "magenta2"
645 "magenta1"
646 "VioletRed4"
647 "VioletRed3"
648 "VioletRed2"
649 "VioletRed1"
650 "maroon4"
651 "maroon3"
652 "maroon2"
653 "maroon1"
654 "PaleVioletRed4"
655 "PaleVioletRed3"
656 "PaleVioletRed2"
657 "PaleVioletRed1"
658 "LightPink4"
659 "LightPink3"
660 "LightPink2"
661 "LightPink1"
662 "pink4"
663 "pink3"
664 "pink2"
665 "pink1"
666 "HotPink4"
667 "HotPink3"
668 "HotPink2"
669 "HotPink1"
670 "DeepPink4"
671 "DeepPink3"
672 "DeepPink2"
673 "DeepPink1"
674 "red4"
675 "red3"
676 "red2"
677 "red1"
678 "OrangeRed4"
679 "OrangeRed3"
680 "OrangeRed2"
681 "OrangeRed1"
682 "tomato4"
683 "tomato3"
684 "tomato2"
685 "tomato1"
686 "coral4"
687 "coral3"
688 "coral2"
689 "coral1"
690 "DarkOrange4"
691 "DarkOrange3"
692 "DarkOrange2"
693 "DarkOrange1"
694 "orange4"
695 "orange3"
696 "orange2"
697 "orange1"
698 "LightSalmon4"
699 "LightSalmon3"
700 "LightSalmon2"
701 "LightSalmon1"
702 "salmon4"
703 "salmon3"
704 "salmon2"
705 "salmon1"
706 "brown4"
707 "brown3"
708 "brown2"
709 "brown1"
710 "firebrick4"
711 "firebrick3"
712 "firebrick2"
713 "firebrick1"
714 "chocolate4"
715 "chocolate3"
716 "chocolate2"
717 "chocolate1"
718 "tan4"
719 "tan3"
720 "tan2"
721 "tan1"
722 "wheat4"
723 "wheat3"
724 "wheat2"
725 "wheat1"
726 "burlywood4"
727 "burlywood3"
728 "burlywood2"
729 "burlywood1"
730 "sienna4"
731 "sienna3"
732 "sienna2"
733 "sienna1"
734 "IndianRed4"
735 "IndianRed3"
736 "IndianRed2"
737 "IndianRed1"
738 "RosyBrown4"
739 "RosyBrown3"
740 "RosyBrown2"
741 "RosyBrown1"
742 "DarkGoldenrod4"
743 "DarkGoldenrod3"
744 "DarkGoldenrod2"
745 "DarkGoldenrod1"
746 "goldenrod4"
747 "goldenrod3"
748 "goldenrod2"
749 "goldenrod1"
750 "gold4"
751 "gold3"
752 "gold2"
753 "gold1"
754 "yellow4"
755 "yellow3"
756 "yellow2"
757 "yellow1"
758 "LightYellow4"
759 "LightYellow3"
760 "LightYellow2"
761 "LightYellow1"
762 "LightGoldenrod4"
763 "LightGoldenrod3"
764 "LightGoldenrod2"
765 "LightGoldenrod1"
766 "khaki4"
767 "khaki3"
768 "khaki2"
769 "khaki1"
770 "DarkOliveGreen4"
771 "DarkOliveGreen3"
772 "DarkOliveGreen2"
773 "DarkOliveGreen1"
774 "OliveDrab4"
775 "OliveDrab3"
776 "OliveDrab2"
777 "OliveDrab1"
778 "chartreuse4"
779 "chartreuse3"
780 "chartreuse2"
781 "chartreuse1"
782 "green4"
783 "green3"
784 "green2"
785 "green1"
786 "SpringGreen4"
787 "SpringGreen3"
788 "SpringGreen2"
789 "SpringGreen1"
790 "PaleGreen4"
791 "PaleGreen3"
792 "PaleGreen2"
793 "PaleGreen1"
794 "SeaGreen4"
795 "SeaGreen3"
796 "SeaGreen2"
797 "SeaGreen1"
798 "DarkSeaGreen4"
799 "DarkSeaGreen3"
800 "DarkSeaGreen2"
801 "DarkSeaGreen1"
802 "aquamarine4"
803 "aquamarine3"
804 "aquamarine2"
805 "aquamarine1"
806 "DarkSlateGray4"
807 "DarkSlateGray3"
808 "DarkSlateGray2"
809 "DarkSlateGray1"
810 "cyan4"
811 "cyan3"
812 "cyan2"
813 "cyan1"
814 "turquoise4"
815 "turquoise3"
816 "turquoise2"
817 "turquoise1"
818 "CadetBlue4"
819 "CadetBlue3"
820 "CadetBlue2"
821 "CadetBlue1"
822 "PaleTurquoise4"
823 "PaleTurquoise3"
824 "PaleTurquoise2"
825 "PaleTurquoise1"
826 "LightCyan4"
827 "LightCyan3"
828 "LightCyan2"
829 "LightCyan1"
830 "LightBlue4"
831 "LightBlue3"
832 "LightBlue2"
833 "LightBlue1"
834 "LightSteelBlue4"
835 "LightSteelBlue3"
836 "LightSteelBlue2"
837 "LightSteelBlue1"
838 "SlateGray4"
839 "SlateGray3"
840 "SlateGray2"
841 "SlateGray1"
842 "LightSkyBlue4"
843 "LightSkyBlue3"
844 "LightSkyBlue2"
845 "LightSkyBlue1"
846 "SkyBlue4"
847 "SkyBlue3"
848 "SkyBlue2"
849 "SkyBlue1"
850 "DeepSkyBlue4"
851 "DeepSkyBlue3"
852 "DeepSkyBlue2"
853 "DeepSkyBlue1"
854 "SteelBlue4"
855 "SteelBlue3"
856 "SteelBlue2"
857 "SteelBlue1"
858 "DodgerBlue4"
859 "DodgerBlue3"
860 "DodgerBlue2"
861 "DodgerBlue1"
862 "blue4"
863 "blue3"
864 "blue2"
865 "blue1"
866 "RoyalBlue4"
867 "RoyalBlue3"
868 "RoyalBlue2"
869 "RoyalBlue1"
870 "SlateBlue4"
871 "SlateBlue3"
872 "SlateBlue2"
873 "SlateBlue1"
874 "azure4"
875 "azure3"
876 "azure2"
877 "azure1"
878 "MistyRose4"
879 "MistyRose3"
880 "MistyRose2"
881 "MistyRose1"
882 "LavenderBlush4"
883 "LavenderBlush3"
884 "LavenderBlush2"
885 "LavenderBlush1"
886 "honeydew4"
887 "honeydew3"
888 "honeydew2"
889 "honeydew1"
890 "ivory4"
891 "ivory3"
892 "ivory2"
893 "ivory1"
894 "cornsilk4"
895 "cornsilk3"
896 "cornsilk2"
897 "cornsilk1"
898 "LemonChiffon4"
899 "LemonChiffon3"
900 "LemonChiffon2"
901 "LemonChiffon1"
902 "NavajoWhite4"
903 "NavajoWhite3"
904 "NavajoWhite2"
905 "NavajoWhite1"
906 "PeachPuff4"
907 "PeachPuff3"
908 "PeachPuff2"
909 "PeachPuff1"
910 "bisque4"
911 "bisque3"
912 "bisque2"
913 "bisque1"
914 "AntiqueWhite4"
915 "AntiqueWhite3"
916 "AntiqueWhite2"
917 "AntiqueWhite1"
918 "seashell4"
919 "seashell3"
920 "seashell2"
921 "seashell1"
922 "snow4"
923 "snow3"
924 "snow2"
925 "snow1"
926 "thistle"
927 "MediumPurple"
928 "medium purple"
929 "purple"
930 "BlueViolet"
931 "blue violet"
932 "DarkViolet"
933 "dark violet"
934 "DarkOrchid"
935 "dark orchid"
936 "MediumOrchid"
937 "medium orchid"
938 "orchid"
939 "plum"
940 "violet"
941 "magenta"
942 "VioletRed"
943 "violet red"
944 "MediumVioletRed"
945 "medium violet red"
946 "maroon"
947 "PaleVioletRed"
948 "pale violet red"
949 "LightPink"
950 "light pink"
951 "pink"
952 "DeepPink"
953 "deep pink"
954 "HotPink"
955 "hot pink"
956 "red"
957 "OrangeRed"
958 "orange red"
959 "tomato"
960 "LightCoral"
961 "light coral"
63f77899 962 "coral"
38fb1ad4
GM
963 "DarkOrange"
964 "dark orange"
965 "orange"
966 "LightSalmon"
967 "light salmon"
968 "salmon"
969 "DarkSalmon"
970 "dark salmon"
63f77899 971 "brown"
38fb1ad4
GM
972 "firebrick"
973 "chocolate"
974 "tan"
975 "SandyBrown"
976 "sandy brown"
977 "wheat"
978 "beige"
979 "burlywood"
980 "peru"
981 "sienna"
982 "SaddleBrown"
983 "saddle brown"
984 "IndianRed"
985 "indian red"
986 "RosyBrown"
987 "rosy brown"
988 "DarkGoldenrod"
989 "dark goldenrod"
63f77899 990 "goldenrod"
38fb1ad4
GM
991 "LightGoldenrod"
992 "light goldenrod"
993 "gold"
994 "yellow"
995 "LightYellow"
996 "light yellow"
997 "LightGoldenrodYellow"
998 "light goldenrod yellow"
999 "PaleGoldenrod"
1000 "pale goldenrod"
1001 "khaki"
1002 "DarkKhaki"
1003 "dark khaki"
1004 "OliveDrab"
1005 "olive drab"
63f77899 1006 "ForestGreen"
38fb1ad4
GM
1007 "forest green"
1008 "YellowGreen"
1009 "yellow green"
63f77899 1010 "LimeGreen"
38fb1ad4
GM
1011 "lime green"
1012 "GreenYellow"
1013 "green yellow"
63f77899 1014 "MediumSpringGreen"
38fb1ad4
GM
1015 "medium spring green"
1016 "chartreuse"
1017 "green"
1018 "LawnGreen"
1019 "lawn green"
1020 "SpringGreen"
1021 "spring green"
63f77899 1022 "PaleGreen"
38fb1ad4
GM
1023 "pale green"
1024 "LightSeaGreen"
1025 "light sea green"
1026 "MediumSeaGreen"
1027 "medium sea green"
63f77899 1028 "SeaGreen"
38fb1ad4
GM
1029 "sea green"
1030 "DarkSeaGreen"
1031 "dark sea green"
1032 "DarkOliveGreen"
1033 "dark olive green"
1034 "DarkGreen"
1035 "dark green"
1036 "aquamarine"
1037 "MediumAquamarine"
1038 "medium aquamarine"
1039 "CadetBlue"
1040 "cadet blue"
1041 "LightCyan"
1042 "light cyan"
1043 "cyan"
63f77899 1044 "turquoise"
63f77899 1045 "MediumTurquoise"
38fb1ad4
GM
1046 "medium turquoise"
1047 "DarkTurquoise"
1048 "dark turquoise"
1049 "PaleTurquoise"
1050 "pale turquoise"
1051 "PowderBlue"
1052 "powder blue"
1053 "LightBlue"
1054 "light blue"
1055 "LightSteelBlue"
1056 "light steel blue"
1057 "SteelBlue"
1058 "steel blue"
1059 "LightSkyBlue"
1060 "light sky blue"
1061 "SkyBlue"
1062 "sky blue"
1063 "DeepSkyBlue"
1064 "deep sky blue"
1065 "DodgerBlue"
1066 "dodger blue"
1067 "blue"
1068 "RoyalBlue"
1069 "royal blue"
1070 "MediumBlue"
1071 "medium blue"
1072 "LightSlateBlue"
1073 "light slate blue"
1074 "MediumSlateBlue"
1075 "medium slate blue"
1076 "SlateBlue"
1077 "slate blue"
1078 "DarkSlateBlue"
1079 "dark slate blue"
1080 "CornflowerBlue"
1081 "cornflower blue"
1082 "NavyBlue"
1083 "navy blue"
1084 "navy"
1085 "MidnightBlue"
1086 "midnight blue"
1087 "LightGray"
1088 "light gray"
1089 "LightGrey"
1090 "light grey"
1091 "grey"
1092 "gray"
1093 "LightSlateGrey"
1094 "light slate grey"
1095 "LightSlateGray"
1096 "light slate gray"
1097 "SlateGrey"
1098 "slate grey"
1099 "SlateGray"
1100 "slate gray"
1101 "DimGrey"
1102 "dim grey"
1103 "DimGray"
1104 "dim gray"
1105 "DarkSlateGrey"
1106 "dark slate grey"
1107 "DarkSlateGray"
1108 "dark slate gray"
1109 "black"
63f77899 1110 "white"
38fb1ad4
GM
1111 "MistyRose"
1112 "misty rose"
1113 "LavenderBlush"
1114 "lavender blush"
1115 "lavender"
1116 "AliceBlue"
1117 "alice blue"
1118 "azure"
1119 "MintCream"
1120 "mint cream"
1121 "honeydew"
1122 "seashell"
1123 "LemonChiffon"
1124 "lemon chiffon"
1125 "ivory"
1126 "cornsilk"
1127 "moccasin"
1128 "NavajoWhite"
1129 "navajo white"
1130 "PeachPuff"
1131 "peach puff"
1132 "bisque"
1133 "BlanchedAlmond"
1134 "blanched almond"
1135 "PapayaWhip"
1136 "papaya whip"
1137 "AntiqueWhite"
1138 "antique white"
1139 "linen"
1140 "OldLace"
1141 "old lace"
1142 "FloralWhite"
1143 "floral white"
1144 "gainsboro"
1145 "WhiteSmoke"
1146 "white smoke"
1147 "GhostWhite"
1148 "ghost white"
1149 "snow")
1150 "The list of X colors from the `rgb.txt' file.
1151XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
63f77899 1152
f795f633
EZ
1153(defun xw-defined-colors (&optional frame)
1154 "Internal function called by `defined-colors', which see."
891eb3fe 1155 (or frame (setq frame (selected-frame)))
63f77899
JB
1156 (let ((all-colors x-colors)
1157 (this-color nil)
1158 (defined-colors nil))
1159 (while all-colors
1160 (setq this-color (car all-colors)
1161 all-colors (cdr all-colors))
79b24da3 1162 (and (color-supported-p this-color frame t)
63f77899
JB
1163 (setq defined-colors (cons this-color defined-colors))))
1164 defined-colors))
63f77899 1165\f
98bf0c8d
JB
1166;;;; Function keys
1167
2d7bfcc3
RS
1168(substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
1169 global-map)
e9de784c 1170
3d80ef3f
RS
1171;; Map certain keypad keys into ASCII characters
1172;; that people usually expect.
1173(define-key function-key-map [backspace] [127])
1174(define-key function-key-map [delete] [127])
1175(define-key function-key-map [tab] [?\t])
1176(define-key function-key-map [linefeed] [?\n])
b8e9a326
RS
1177(define-key function-key-map [clear] [?\C-l])
1178(define-key function-key-map [return] [?\C-m])
3d80ef3f
RS
1179(define-key function-key-map [escape] [?\e])
1180(define-key function-key-map [M-backspace] [?\M-\d])
1181(define-key function-key-map [M-delete] [?\M-\d])
1182(define-key function-key-map [M-tab] [?\M-\t])
1183(define-key function-key-map [M-linefeed] [?\M-\n])
b8e9a326
RS
1184(define-key function-key-map [M-clear] [?\M-\C-l])
1185(define-key function-key-map [M-return] [?\M-\C-m])
3d80ef3f 1186(define-key function-key-map [M-escape] [?\M-\e])
87c033db 1187(define-key function-key-map [iso-lefttab] [backtab])
8f96b49b 1188(define-key function-key-map [S-iso-lefttab] [backtab])
3d80ef3f
RS
1189
1190;; These tell read-char how to convert
1191;; these special chars to ASCII.
1192(put 'backspace 'ascii-character 127)
1193(put 'delete 'ascii-character 127)
1194(put 'tab 'ascii-character ?\t)
1195(put 'linefeed 'ascii-character ?\n)
1196(put 'clear 'ascii-character 12)
1197(put 'return 'ascii-character 13)
1198(put 'escape 'ascii-character ?\e)
afa43349 1199
cf07d2bd
DL
1200\f
1201;;;; Keysyms
1202
9b4234ae 1203(defun vendor-specific-keysyms (vendor)
089bc712 1204 "Return the appropriate value of `system-key-alist' for VENDOR.
9b4234ae 1205VENDOR is a string containing the name of the X Server's vendor,
089bc712 1206as returned by `x-server-vendor'."
cf07d2bd 1207 ;; Fixme: Drop Apollo now?
9b4234ae
RS
1208 (cond ((string-equal vendor "Apollo Computer Inc.")
1209 '((65280 . linedel)
1210 (65281 . chardel)
1211 (65282 . copy)
1212 (65283 . cut)
1213 (65284 . paste)
1214 (65285 . move)
1215 (65286 . grow)
1216 (65287 . cmd)
1217 (65288 . shell)
1218 (65289 . leftbar)
1219 (65290 . rightbar)
1220 (65291 . leftbox)
1221 (65292 . rightbox)
1222 (65293 . upbox)
1223 (65294 . downbox)
1224 (65295 . pop)
1225 (65296 . read)
1226 (65297 . edit)
1227 (65298 . save)
1228 (65299 . exit)
1229 (65300 . repeat)))
3f18a142
KH
1230 ((or (string-equal vendor "Hewlett-Packard Incorporated")
1231 (string-equal vendor "Hewlett-Packard Company"))
9b4234ae
RS
1232 '(( 168 . mute-acute)
1233 ( 169 . mute-grave)
1234 ( 170 . mute-asciicircum)
1235 ( 171 . mute-diaeresis)
1236 ( 172 . mute-asciitilde)
1237 ( 175 . lira)
1238 ( 190 . guilder)
1239 ( 252 . block)
1240 ( 256 . longminus)
1241 (65388 . reset)
1242 (65389 . system)
1243 (65390 . user)
1244 (65391 . clearline)
1245 (65392 . insertline)
1246 (65393 . deleteline)
1247 (65394 . insertchar)
1248 (65395 . deletechar)
1249 (65396 . backtab)
1250 (65397 . kp-backtab)))
cf07d2bd 1251 ;; Fixme: What about non-X11/NeWS sun server?
04486a2d
KH
1252 ((or (string-equal vendor "X11/NeWS - Sun Microsystems Inc.")
1253 (string-equal vendor "X Consortium"))
51a8e1cc
KH
1254 '((392976 . f36)
1255 (392977 . f37)
9b4234ae
RS
1256 (393056 . req)
1257 ;; These are for Sun under X11R6
1258 (393072 . props)
1259 (393073 . front)
1260 (393074 . copy)
1261 (393075 . open)
1262 (393076 . paste)
1263 (393077 . cut)))
1264 (t
1265 ;; This is used by DEC's X server.
1266 '((65280 . remove)))))
1267
cf07d2bd
DL
1268(let ((i 160))
1269 (while (< i 256)
1270 (puthash i (make-char 'latin-iso8859-1 i) x-keysym-table)
1271 (setq i (1+ i))))
1272
1273;; Table from Kuhn's proposed additions to the `KEYSYM Encoding'
1274;; appendix to the X protocol definition.
1275(dolist
1276 (pair
1277 '(
1278 ;; Latin-2
1279 (#x1a1 . ?\e,B!\e(B)
1280 (#x1a2 . ?\e,B"\e(B)
1281 (#x1a3 . ?\e,B#\e(B)
1282 (#x1a5 . ?\e,B%\e(B)
1283 (#x1a6 . ?\e,B&\e(B)
1284 (#x1a9 . ?\e,B)\e(B)
1285 (#x1aa . ?\e,B*\e(B)
1286 (#x1ab . ?\e,B+\e(B)
1287 (#x1ac . ?\e,B,\e(B)
1288 (#x1ae . ?\e,B.\e(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(B)
1332 (#x1f9 . ?\e,By\e(B)
1333 (#x1fb . ?\e,B{\e(B)
1334 (#x1fe . ?\e,B~\e(B)
1335 (#x1ff . ?\e,B\7f\e(B)
1336 ;; Latin-3
1337 (#x2a1 . ?\e,C!\e(B)
1338 (#x2a6 . ?\e,C&\e(B)
1339 (#x2a9 . ?\e,C)\e(B)
1340 (#x2ab . ?\e,C+\e(B)
1341 (#x2ac . ?\e,C,\e(B)
1342 (#x2b1 . ?\e,C1\e(B)
1343 (#x2b6 . ?\e,C6\e(B)
1344 (#x2b9 . ?\e,C9\e(B)
1345 (#x2bb . ?\e,C;\e(B)
1346 (#x2bc . ?\e,C<\e(B)
1347 (#x2c5 . ?\e,CE\e(B)
1348 (#x2c6 . ?\e,CF\e(B)
1349 (#x2d5 . ?\e,CU\e(B)
1350 (#x2d8 . ?\e,CX\e(B)
1351 (#x2dd . ?\e,C]\e(B)
1352 (#x2de . ?\e,C^\e(B)
1353 (#x2e5 . ?\e,Ce\e(B)
1354 (#x2e6 . ?\e,Cf\e(B)
1355 (#x2f5 . ?\e,Cu\e(B)
1356 (#x2f8 . ?\e,Cx\e(B)
1357 (#x2fd . ?\e,C}\e(B)
1358 (#x2fe . ?\e,C~\e(B)
1359 ;; Latin-4
1360 (#x3a2 . ?\e,D"\e(B)
1361 (#x3a3 . ?\e,D#\e(B)
1362 (#x3a5 . ?\e,D%\e(B)
1363 (#x3a6 . ?\e,D&\e(B)
1364 (#x3aa . ?\e,D*\e(B)
1365 (#x3ab . ?\e,D+\e(B)
1366 (#x3ac . ?\e,D,\e(B)
1367 (#x3b3 . ?\e,D3\e(B)
1368 (#x3b5 . ?\e,D5\e(B)
1369 (#x3b6 . ?\e,D6\e(B)
1370 (#x3ba . ?\e,D:\e(B)
1371 (#x3bb . ?\e,D;\e(B)
1372 (#x3bc . ?\e,D<\e(B)
1373 (#x3bd . ?\e,D=\e(B)
1374 (#x3bf . ?\e,D?\e(B)
1375 (#x3c0 . ?\e,D@\e(B)
1376 (#x3c7 . ?\e,DG\e(B)
1377 (#x3cc . ?\e,DL\e(B)
1378 (#x3cf . ?\e,DO\e(B)
1379 (#x3d1 . ?\e,DQ\e(B)
1380 (#x3d2 . ?\e,DR\e(B)
1381 (#x3d3 . ?\e,DS\e(B)
1382 (#x3d9 . ?\e,DY\e(B)
1383 (#x3dd . ?\e,D]\e(B)
1384 (#x3de . ?\e,D^\e(B)
1385 (#x3e0 . ?\e,D`\e(B)
1386 (#x3e7 . ?\e,Dg\e(B)
1387 (#x3ec . ?\e,Dl\e(B)
1388 (#x3ef . ?\e,Do\e(B)
1389 (#x3f1 . ?\e,Dq\e(B)
1390 (#x3f2 . ?\e,Dr\e(B)
1391 (#x3f3 . ?\e,Ds\e(B)
1392 (#x3f9 . ?\e,Dy\e(B)
1393 (#x3fd . ?\e,D}\e(B)
1394 (#x3fe . ?\e,D~\e(B)
1395 ;; Kana: Fixme: needs conversion to Japanese charset -- seems
1396 ;; to require jisx0213, for which the Unicode translation
1397 ;; isn't clear.
1398 (#x47e . ?\e$,1s>\e(B)
1399 (#x4a1 . ?\e$,2=B\e(B)
1400 (#x4a2 . ?\\e$,2=L\e(B)
1401 (#x4a3 . ?\\e$,2=M\e(B)
1402 (#x4a4 . ?\e$,2=A\e(B)
1403 (#x4a5 . ?\e$,2?{\e(B)
1404 (#x4a6 . ?\e$,2?r\e(B)
1405 (#x4a7 . ?\e$,2?!\e(B)
1406 (#x4a8 . ?\e$,2?#\e(B)
1407 (#x4a9 . ?\e$,2?%\e(B)
1408 (#x4aa . ?\e$,2?'\e(B)
1409 (#x4ab . ?\e$,2?)\e(B)
1410 (#x4ac . ?\e$,2?c\e(B)
1411 (#x4ad . ?\e$,2?e\e(B)
1412 (#x4ae . ?\e$,2?g\e(B)
1413 (#x4af . ?\e$,2?C\e(B)
1414 (#x4b0 . ?\e$,2?|\e(B)
1415 (#x4b1 . ?\e$,2?"\e(B)
1416 (#x4b2 . ?\e$,2?$\e(B)
1417 (#x4b3 . ?\e$,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fu\e(B)
1673 (#x7f6 . ?\e,Fv\e(B)
1674 (#x7f7 . ?\e,Fw\e(B)
1675 (#x7f8 . ?\e,Fx\e(B)
1676 (#x7f9 . ?\e,Fy\e(B)
1677 ;; Technical
1678 (#x8a1 . ?\e$,1|W\e(B)
1679 (#x8a2 . ?\e$,2 ,\e(B)
1680 (#x8a3 . ?\e$,2 \e(B)
1681 (#x8a4 . ?\e$,1{ \e(B)
1682 (#x8a5 . ?\e$,1{!\e(B)
1683 (#x8a6 . ?\e$,2 "\e(B)
1684 (#x8a7 . ?\e$,1|A\e(B)
1685 (#x8a8 . ?\e$,1|C\e(B)
1686 (#x8a9 . ?\e$,1|D\e(B)
1687 (#x8aa . ?\e$,1|F\e(B)
1688 (#x8ab . ?\e$,1|;\e(B)
1689 (#x8ac . ?\e$,1|=\e(B)
1690 (#x8ad . ?\e$,1|>\e(B)
1691 (#x8ae . ?\e$,1|@\e(B)
1692 (#x8af . ?\e$,1|H\e(B)
1693 (#x8b0 . ?\e$,1|L\e(B)
1694 (#x8bc . ?\e$,1y$\e(B)
1695 (#x8bd . ?\e$,1y \e(B)
1696 (#x8be . ?\e$,1y%\e(B)
1697 (#x8bf . ?\e$,1xK\e(B)
1698 (#x8c0 . ?\e$,1xT\e(B)
1699 (#x8c1 . ?\e$,1x=\e(B)
1700 (#x8c2 . ?\e$,1x>\e(B)
1701 (#x8c5 . ?\e$,1x'\e(B)
1702 (#x8c8 . ?\e$,1x\\e(B)
1703 (#x8c9 . ?\e$,1xc\e(B)
1704 (#x8cd . ?\e$,1wT\e(B)
1705 (#x8ce . ?\e$,1wR\e(B)
1706 (#x8cf . ?\e$,1y!\e(B)
1707 (#x8d6 . ?\e$,1x:\e(B)
1708 (#x8da . ?\e$,1yB\e(B)
1709 (#x8db . ?\e$,1yC\e(B)
1710 (#x8dc . ?\e$,1xI\e(B)
1711 (#x8dd . ?\e$,1xJ\e(B)
1712 (#x8de . ?\e$,1xG\e(B)
1713 (#x8df . ?\e$,1xH\e(B)
1714 (#x8ef . ?\e$,1x"\e(B)
1715 (#x8f6 . ?\e$,1!R\e(B)
1716 (#x8fb . ?\e$,1vp\e(B)
1717 (#x8fc . ?\e$,1vq\e(B)
1718 (#x8fd . ?\e$,1vr\e(B)
1719 (#x8fe . ?\e$,1vs\e(B)
1720 ;; Special
1721 (#x9e0 . ?\e$,2"&\e(B)
1722 (#x9e1 . ?\e$,2!R\e(B)
1723 (#x9e2 . ?\e$,1}I\e(B)
1724 (#x9e3 . ?\e$,1}L\e(B)
1725 (#x9e4 . ?\e$,1}M\e(B)
1726 (#x9e5 . ?\e$,1}J\e(B)
1727 (#x9e8 . ?\e$,1}d\e(B)
1728 (#x9e9 . ?\e$,1}K\e(B)
1729 (#x9ea . ?\e$,2 8\e(B)
1730 (#x9eb . ?\e$,2 0\e(B)
1731 (#x9ec . ?\e$,2 ,\e(B)
1732 (#x9ed . ?\e$,2 4\e(B)
1733 (#x9ee . ?\e$,2 \\e(B)
1734 (#x9ef . ?\e$,1|Z\e(B)
1735 (#x9f0 . ?\e$,1|[\e(B)
1736 (#x9f1 . ?\e$,2 \e(B)
1737 (#x9f2 . ?\e$,1|\\e(B)
1738 (#x9f3 . ?\e$,1|]\e(B)
1739 (#x9f4 . ?\e$,2 <\e(B)
1740 (#x9f5 . ?\e$,2 D\e(B)
1741 (#x9f6 . ?\e$,2 T\e(B)
1742 (#x9f7 . ?\e$,2 L\e(B)
1743 (#x9f8 . ?\e$,2 "\e(B)
1744 ;; Publishing
1745 (#xaa1 . ?\e$,1rc\e(B)
1746 (#xaa2 . ?\e$,1rb\e(B)
1747 (#xaa3 . ?\e$,1rd\e(B)
1748 (#xaa4 . ?\e$,1re\e(B)
1749 (#xaa5 . ?\e$,1rg\e(B)
1750 (#xaa6 . ?\e$,1rh\e(B)
1751 (#xaa7 . ?\e$,1ri\e(B)
1752 (#xaa8 . ?\e$,1rj\e(B)
1753 (#xaa9 . ?\e$,1rt\e(B)
1754 (#xaaa . ?\e$,1rs\e(B)
1755 (#xaae . ?\e$,1s&\e(B)
1756 (#xaaf . ?\e$,1s%\e(B)
1757 (#xab0 . ?\e$,1v3\e(B)
1758 (#xab1 . ?\e$,1v4\e(B)
1759 (#xab2 . ?\e$,1v5\e(B)
1760 (#xab3 . ?\e$,1v6\e(B)
1761 (#xab4 . ?\e$,1v7\e(B)
1762 (#xab5 . ?\e$,1v8\e(B)
1763 (#xab6 . ?\e$,1v9\e(B)
1764 (#xab7 . ?\e$,1v:\e(B)
1765 (#xab8 . ?\e$,1uE\e(B)
1766 (#xabb . ?\e$,1rr\e(B)
1767 (#xabc . ?\e$,1{)\e(B)
1768 (#xabe . ?\e$,1{*\e(B)
1769 (#xac3 . ?\e$,1v;\e(B)
1770 (#xac4 . ?\e$,1v<\e(B)
1771 (#xac5 . ?\e$,1v=\e(B)
1772 (#xac6 . ?\e$,1v>\e(B)
1773 (#xac9 . ?\e$,1ub\e(B)
1774 (#xaca . ?\e$,2"s\e(B)
1775 (#xacc . ?\e$,2"!\e(B)
1776 (#xacd . ?\e$,2!w\e(B)
1777 (#xace . ?\e$,2"+\e(B)
1778 (#xacf . ?\e$,2!o\e(B)
1779 (#xad0 . ?\e$,1rx\e(B)
1780 (#xad1 . ?\e$,1ry\e(B)
1781 (#xad2 . ?\e$,1r|\e(B)
1782 (#xad3 . ?\e$,1r}\e(B)
1783 (#xad4 . ?\e$,1u^\e(B)
1784 (#xad6 . ?\e$,1s2\e(B)
1785 (#xad7 . ?\e$,1s3\e(B)
1786 (#xad9 . ?\e$,2%]\e(B)
1787 (#xadb . ?\e$,2!l\e(B)
1788 (#xadc . ?\e$,2" \e(B)
1789 (#xadd . ?\e$,2!v\e(B)
1790 (#xade . ?\e$,2"/\e(B)
1791 (#xadf . ?\e$,2!n\e(B)
1792 (#xae0 . ?\e$,2"F\e(B)
1793 (#xae1 . ?\e$,2!k\e(B)
1794 (#xae2 . ?\e$,2!m\e(B)
1795 (#xae3 . ?\e$,2!s\e(B)
1796 (#xae4 . ?\e$,2!}\e(B)
1797 (#xae5 . ?\e$,2"f\e(B)
1798 (#xae6 . ?\e$,1s"\e(B)
1799 (#xae7 . ?\e$,2!j\e(B)
1800 (#xae8 . ?\e$,2!r\e(B)
1801 (#xae9 . ?\e$,2!|\e(B)
1802 (#xaea . ?\e$,2"|\e(B)
1803 (#xaeb . ?\e$,2"~\e(B)
1804 (#xaec . ?\e$,2#c\e(B)
1805 (#xaed . ?\e$,2#f\e(B)
1806 (#xaee . ?\e$,2#e\e(B)
1807 (#xaf0 . ?\e$,2%`\e(B)
1808 (#xaf1 . ?\e$,1s \e(B)
1809 (#xaf2 . ?\e$,1s!\e(B)
1810 (#xaf3 . ?\e$,2%S\e(B)
1811 (#xaf4 . ?\e$,2%W\e(B)
1812 (#xaf5 . ?\e$,2#o\e(B)
1813 (#xaf6 . ?\e$,2#m\e(B)
1814 (#xaf7 . ?\e$,2#B\e(B)
1815 (#xaf8 . ?\e$,2#@\e(B)
1816 (#xaf9 . ?\e$,2"n\e(B)
1817 (#xafa . ?\e$,1zu\e(B)
1818 (#xafb . ?\e$,1uW\e(B)
1819 (#xafc . ?\e$,1s8\e(B)
1820 (#xafd . ?\e$,1rz\e(B)
1821 (#xafe . ?\e$,1r~\e(B)
1822 ;; APL
1823 (#xba3 . ?<)
1824 (#xba6 . ?>)
1825 (#xba8 . ?\e$,1xH\e(B)
1826 (#xba9 . ?\e$,1xG\e(B)
1827 (#xbc0 . ?\e,A/\e(B)
1828 (#xbc2 . ?\e$,1ye\e(B)
1829 (#xbc3 . ?\e$,1xI\e(B)
1830 (#xbc4 . ?\e$,1zj\e(B)
1831 (#xbc6 . ?_)
1832 (#xbca . ?\e$,1x8\e(B)
1833 (#xbcc . ?\e$,1|5\e(B)
1834 (#xbce . ?\e$,1yd\e(B)
1835 (#xbcf . ?\e$,2"+\e(B)
1836 (#xbd3 . ?\e$,1zh\e(B)
1837 (#xbd6 . ?\e$,1xJ\e(B)
1838 (#xbd8 . ?\e$,1yC\e(B)
1839 (#xbda . ?\e$,1yB\e(B)
1840 (#xbdc . ?\e$,1yb\e(B)
1841 (#xbfc . ?\e$,1yc\e(B)
1842 ;; Hebrew
1843 (#xcdf . ?\e,H_\e(B)
1844 (#xce0 . ?\e,H`\e(B)
1845 (#xce1 . ?\e,Ha\e(B)
1846 (#xce2 . ?\e,Hb\e(B)
1847 (#xce3 . ?\e,Hc\e(B)
1848 (#xce4 . ?\e,Hd\e(B)
1849 (#xce5 . ?\e,He\e(B)
1850 (#xce6 . ?\e,Hf\e(B)
1851 (#xce7 . ?\e,Hg\e(B)
1852 (#xce8 . ?\e,Hh\e(B)
1853 (#xce9 . ?\e,Hi\e(B)
1854 (#xcea . ?\e,Hj\e(B)
1855 (#xceb . ?\e,Hk\e(B)
1856 (#xcec . ?\e,Hl\e(B)
1857 (#xced . ?\e,Hm\e(B)
1858 (#xcee . ?\e,Hn\e(B)
1859 (#xcef . ?\e,Ho\e(B)
1860 (#xcf0 . ?\e,Hp\e(B)
1861 (#xcf1 . ?\e,Hq\e(B)
1862 (#xcf2 . ?\e,Hr\e(B)
1863 (#xcf3 . ?\e,Hs\e(B)
1864 (#xcf4 . ?\e,Ht\e(B)
1865 (#xcf5 . ?\e,Hu\e(B)
1866 (#xcf6 . ?\e,Hv\e(B)
1867 (#xcf7 . ?\e,Hw\e(B)
1868 (#xcf8 . ?\e,Hx\e(B)
1869 (#xcf9 . ?\e,Hy\e(B)
1870 (#xcfa . ?\e,Hz\e(B)
1871 ;; Thai
1872 (#xda1 . ?\e,T!\e(B)
1873 (#xda2 . ?\e,T"\e(B)
1874 (#xda3 . ?\e,T#\e(B)
1875 (#xda4 . ?\e,T$\e(B)
1876 (#xda5 . ?\e,T%\e(B)
1877 (#xda6 . ?\e,T&\e(B)
1878 (#xda7 . ?\e,T'\e(B)
1879 (#xda8 . ?\e,T(\e(B)
1880 (#xda9 . ?\e,T)\e(B)
1881 (#xdaa . ?\e,T*\e(B)
1882 (#xdab . ?\e,T+\e(B)
1883 (#xdac . ?\e,T,\e(B)
1884 (#xdad . ?\e,T-\e(B)
1885 (#xdae . ?\e,T.\e(B)
1886 (#xdaf . ?\e,T/\e(B)
1887 (#xdb0 . ?\e,T0\e(B)
1888 (#xdb1 . ?\e,T1\e(B)
1889 (#xdb2 . ?\e,T2\e(B)
1890 (#xdb3 . ?\e,T3\e(B)
1891 (#xdb4 . ?\e,T4\e(B)
1892 (#xdb5 . ?\e,T5\e(B)
1893 (#xdb6 . ?\e,T6\e(B)
1894 (#xdb7 . ?\e,T7\e(B)
1895 (#xdb8 . ?\e,T8\e(B)
1896 (#xdb9 . ?\e,T9\e(B)
1897 (#xdba . ?\e,T:\e(B)
1898 (#xdbb . ?\e,T;\e(B)
1899 (#xdbc . ?\e,T<\e(B)
1900 (#xdbd . ?\e,T=\e(B)
1901 (#xdbe . ?\e,T>\e(B)
1902 (#xdbf . ?\e,T?\e(B)
1903 (#xdc0 . ?\e,T@\e(B)
1904 (#xdc1 . ?\e,TA\e(B)
1905 (#xdc2 . ?\e,TB\e(B)
1906 (#xdc3 . ?\e,TC\e(B)
1907 (#xdc4 . ?\e,TD\e(B)
1908 (#xdc5 . ?\e,TE\e(B)
1909 (#xdc6 . ?\e,TF\e(B)
1910 (#xdc7 . ?\e,TG\e(B)
1911 (#xdc8 . ?\e,TH\e(B)
1912 (#xdc9 . ?\e,TI\e(B)
1913 (#xdca . ?\e,TJ\e(B)
1914 (#xdcb . ?\e,TK\e(B)
1915 (#xdcc . ?\e,TL\e(B)
1916 (#xdcd . ?\e,TM\e(B)
1917 (#xdce . ?\e,TN\e(B)
1918 (#xdcf . ?\e,TO\e(B)
1919 (#xdd0 . ?\e,TP\e(B)
1920 (#xdd1 . ?\e,TQ\e(B)
1921 (#xdd2 . ?\e,TR\e(B)
1922 (#xdd3 . ?\e,TS\e(B)
1923 (#xdd4 . ?\e,TT\e(B)
1924 (#xdd5 . ?\e,TU\e(B)
1925 (#xdd6 . ?\e,TV\e(B)
1926 (#xdd7 . ?\e,TW\e(B)
1927 (#xdd8 . ?\e,TX\e(B)
1928 (#xdd9 . ?\e,TY\e(B)
1929 (#xdda . ?\e,TZ\e(B)
1930 (#xddf . ?\e,T_\e(B)
1931 (#xde0 . ?\e,T`\e(B)
1932 (#xde1 . ?\e,Ta\e(B)
1933 (#xde2 . ?\e,Tb\e(B)
1934 (#xde3 . ?\e,Tc\e(B)
1935 (#xde4 . ?\e,Td\e(B)
1936 (#xde5 . ?\e,Te\e(B)
1937 (#xde6 . ?\e,Tf\e(B)
1938 (#xde7 . ?\e,Tg\e(B)
1939 (#xde8 . ?\e,Th\e(B)
1940 (#xde9 . ?\e,Ti\e(B)
1941 (#xdea . ?\e,Tj\e(B)
1942 (#xdeb . ?\e,Tk\e(B)
1943 (#xdec . ?\e,Tl\e(B)
1944 (#xded . ?\e,Tm\e(B)
1945 (#xdf0 . ?\e,Tp\e(B)
1946 (#xdf1 . ?\e,Tq\e(B)
1947 (#xdf2 . ?\e,Tr\e(B)
1948 (#xdf3 . ?\e,Ts\e(B)
1949 (#xdf4 . ?\e,Tt\e(B)
1950 (#xdf5 . ?\e,Tu\e(B)
1951 (#xdf6 . ?\e,Tv\e(B)
1952 (#xdf7 . ?\e,Tw\e(B)
1953 (#xdf8 . ?\e,Tx\e(B)
1954 (#xdf9 . ?\e,Ty\e(B)
1955 ;; Korean
1956 (#xea1 . ?\e$(C$!\e(B)
1957 (#xea2 . ?\e$(C$"\e(B)
1958 (#xea3 . ?\e$(C$#\e(B)
1959 (#xea4 . ?\e$(C$$\e(B)
1960 (#xea5 . ?\e$(C$%\e(B)
1961 (#xea6 . ?\e$(C$&\e(B)
1962 (#xea7 . ?\e$(C$'\e(B)
1963 (#xea8 . ?\e$(C$(\e(B)
1964 (#xea9 . ?\e$(C$)\e(B)
1965 (#xeaa . ?\e$(C$*\e(B)
1966 (#xeab . ?\e$(C$+\e(B)
1967 (#xeac . ?\e$(C$,\e(B)
1968 (#xead . ?\e$(C$-\e(B)
1969 (#xeae . ?\e$(C$.\e(B)
1970 (#xeaf . ?\e$(C$/\e(B)
1971 (#xeb0 . ?\e$(C$0\e(B)
1972 (#xeb1 . ?\e$(C$1\e(B)
1973 (#xeb2 . ?\e$(C$2\e(B)
1974 (#xeb3 . ?\e$(C$3\e(B)
1975 (#xeb4 . ?\e$(C$4\e(B)
1976 (#xeb5 . ?\e$(C$5\e(B)
1977 (#xeb6 . ?\e$(C$6\e(B)
1978 (#xeb7 . ?\e$(C$7\e(B)
1979 (#xeb8 . ?\e$(C$8\e(B)
1980 (#xeb9 . ?\e$(C$9\e(B)
1981 (#xeba . ?\e$(C$:\e(B)
1982 (#xebb . ?\e$(C$;\e(B)
1983 (#xebc . ?\e$(C$<\e(B)
1984 (#xebd . ?\e$(C$=\e(B)
1985 (#xebe . ?\e$(C$>\e(B)
1986 (#xebf . ?\e$(C$?\e(B)
1987 (#xec0 . ?\e$(C$@\e(B)
1988 (#xec1 . ?\e$(C$A\e(B)
1989 (#xec2 . ?\e$(C$B\e(B)
1990 (#xec3 . ?\e$(C$C\e(B)
1991 (#xec4 . ?\e$(C$D\e(B)
1992 (#xec5 . ?\e$(C$E\e(B)
1993 (#xec6 . ?\e$(C$F\e(B)
1994 (#xec7 . ?\e$(C$G\e(B)
1995 (#xec8 . ?\e$(C$H\e(B)
1996 (#xec9 . ?\e$(C$I\e(B)
1997 (#xeca . ?\e$(C$J\e(B)
1998 (#xecb . ?\e$(C$K\e(B)
1999 (#xecc . ?\e$(C$L\e(B)
2000 (#xecd . ?\e$(C$M\e(B)
2001 (#xece . ?\e$(C$N\e(B)
2002 (#xecf . ?\e$(C$O\e(B)
2003 (#xed0 . ?\e$(C$P\e(B)
2004 (#xed1 . ?\e$(C$Q\e(B)
2005 (#xed2 . ?\e$(C$R\e(B)
2006 (#xed3 . ?\e$(C$S\e(B)
2007 (#xed4 . ?\e$,1LH\e(B)
2008 (#xed5 . ?\e$,1LI\e(B)
2009 (#xed6 . ?\e$,1LJ\e(B)
2010 (#xed7 . ?\e$,1LK\e(B)
2011 (#xed8 . ?\e$,1LL\e(B)
2012 (#xed9 . ?\e$,1LM\e(B)
2013 (#xeda . ?\e$,1LN\e(B)
2014 (#xedb . ?\e$,1LO\e(B)
2015 (#xedc . ?\e$,1LP\e(B)
2016 (#xedd . ?\e$,1LQ\e(B)
2017 (#xede . ?\e$,1LR\e(B)
2018 (#xedf . ?\e$,1LS\e(B)
2019 (#xee0 . ?\e$,1LT\e(B)
2020 (#xee1 . ?\e$,1LU\e(B)
2021 (#xee2 . ?\e$,1LV\e(B)
2022 (#xee3 . ?\e$,1LW\e(B)
2023 (#xee4 . ?\e$,1LX\e(B)
2024 (#xee5 . ?\e$,1LY\e(B)
2025 (#xee6 . ?\e$,1LZ\e(B)
2026 (#xee7 . ?\e$,1L[\e(B)
2027 (#xee8 . ?\e$,1L\\e(B)
2028 (#xee9 . ?\e$,1L]\e(B)
2029 (#xeea . ?\e$,1L^\e(B)
2030 (#xeeb . ?\e$,1L_\e(B)
2031 (#xeec . ?\e$,1L`\e(B)
2032 (#xeed . ?\e$,1La\e(B)
2033 (#xeee . ?\e$,1Lb\e(B)
2034 (#xeef . ?\e$(C$]\e(B)
2035 (#xef0 . ?\e$(C$a\e(B)
2036 (#xef1 . ?\e$(C$h\e(B)
2037 (#xef2 . ?\e$(C$o\e(B)
2038 (#xef3 . ?\e$(C$q\e(B)
2039 (#xef4 . ?\e$(C$t\e(B)
2040 (#xef5 . ?\e$(C$v\e(B)
2041 (#xef6 . ?\e$(C$}\e(B)
2042 (#xef7 . ?\e$(C$~\e(B)
2043 (#xef8 . ?\e$,1M+\e(B)
2044 (#xef9 . ?\e$,1M0\e(B)
2045 (#xefa . ?\e$,1M9\e(B)
2046 (#xeff . ?\e$,1tI\e(B)
2047 ;; Latin-5
2048 ;; Latin-6
2049 ;; Latin-7
2050 ;; Latin-8
2051 ;; Latin-9
2052 (#x13bc . ?\e,b<\e(B)
2053 (#x13bd . ?\e,b=\e(B)
2054 (#x13be . ?\e,b>\e(B)
2055 ;; Currency
2056 (#x20a0 . ?\e$,1t@\e(B)
2057 (#x20a1 . ?\e$,1tA\e(B)
2058 (#x20a2 . ?\e$,1tB\e(B)
2059 (#x20a3 . ?\e$,1tC\e(B)
2060 (#x20a4 . ?\e$,1tD\e(B)
2061 (#x20a5 . ?\e$,1tE\e(B)
2062 (#x20a6 . ?\e$,1tF\e(B)
2063 (#x20a7 . ?\e$,1tG\e(B)
2064 (#x20a8 . ?\e$,1tH\e(B)
2065 (#x20aa . ?\e$,1tJ\e(B)
2066 (#x20ab . ?\e$,1tK\e(B)
2067 (#x20ac . ?\e,b$\e(B)))
2068 (puthash (car pair) (cdr pair) x-keysym-table))
2069
2070;; The following keysym codes for graphics are listed in the document
2071;; as not having unicodes available:
2072
2073;; #x08b1 TOP LEFT SUMMATION Technical
2074;; #x08b2 BOTTOM LEFT SUMMATION Technical
2075;; #x08b3 TOP VERTICAL SUMMATION CONNECTOR Technical
2076;; #x08b4 BOTTOM VERTICAL SUMMATION CONNECTOR Technical
2077;; #x08b5 TOP RIGHT SUMMATION Technical
2078;; #x08b6 BOTTOM RIGHT SUMMATION Technical
2079;; #x08b7 RIGHT MIDDLE SUMMATION Technical
2080;; #x0aac SIGNIFICANT BLANK SYMBOL Publish
2081;; #x0abd DECIMAL POINT Publish
2082;; #x0abf MARKER Publish
2083;; #x0acb TRADEMARK SIGN IN CIRCLE Publish
2084;; #x0ada HEXAGRAM Publish
2085;; #x0aff CURSOR Publish
2086;; #x0dde THAI MAIHANAKAT Thai
2087
2fb263f6
JB
2088\f
2089;;;; Selections and cut buffers
67c86cfc 2090
daa37602
JB
2091;;; We keep track of the last text selected here, so we can check the
2092;;; current selection against it, and avoid passing back our own text
ae10d597
PJ
2093;;; from x-cut-buffer-or-selection-value. We track all three
2094;;; seperately in case another X application only sets one of them
aa87aafc 2095;;; (say the cut buffer) we aren't fooled by the PRIMARY or
ae10d597
PJ
2096;;; CLIPBOARD selection staying the same.
2097(defvar x-last-selected-text-clipboard nil
2098 "The value of the CLIPBOARD X selection last time we selected or
2099pasted text.")
089bc712 2100(defvar x-last-selected-text-primary nil
ae10d597
PJ
2101 "The value of the PRIMARY X selection last time we selected or
2102pasted text.")
089bc712 2103(defvar x-last-selected-text-cut nil
eb5ad242
KH
2104 "The value of the X cut buffer last time we selected or pasted text.
2105The actual text stored in the X cut buffer is what encoded from this value.")
2106(defvar x-last-selected-text-cut-encoded nil
2107 "The value of the X cut buffer last time we selected or pasted text.
2108This is the actual text stored in the X cut buffer.")
daa37602 2109
2666a6a5 2110;;; It is said that overlarge strings are slow to put into the cut buffer.
ef599142
RS
2111;;; Note this value is overridden below.
2112(defvar x-cut-buffer-max 20000
2666a6a5
RS
2113 "Max number of characters to put in the cut buffer.")
2114
d14518d8 2115(defcustom x-select-enable-clipboard nil
dc20df95 2116 "Non-nil means cutting and pasting uses the clipboard.
d14518d8
DL
2117This is in addition to, but in preference to, the primary selection."
2118 :type 'boolean
2119 :group 'killing)
dc20df95 2120
2666a6a5 2121;;; Make TEXT, a string, the primary X selection.
492878e4 2122;;; Also, set the value of X cut buffer 0, for backward compatibility
d81fd0bf 2123;;; with older X applications.
feeb94f7 2124;;; gildea@stop.mail-abuse.org says it's not desirable to put kills
2666a6a5 2125;;; in the clipboard.
0e2f4e59 2126(defun x-select-text (text &optional push)
785080c5
RS
2127 ;; Don't send the cut buffer too much text.
2128 ;; It becomes slow, and if really big it causes errors.
ae10d597
PJ
2129 (cond ((>= (length text) x-cut-buffer-max)
2130 (x-set-cut-buffer "" push)
eb5ad242
KH
2131 (setq x-last-selected-text-cut ""
2132 x-last-selected-text-cut-encoded ""))
db95369b 2133 (t
eb5ad242
KH
2134 (setq x-last-selected-text-cut text
2135 x-last-selected-text-cut-encoded
2136 (encode-coding-string text (or locale-coding-system
2137 'iso-latin-1)))
2138 (x-set-cut-buffer x-last-selected-text-cut-encoded push)))
c8c72d6b 2139 (x-set-selection 'PRIMARY text)
ae10d597
PJ
2140 (setq x-last-selected-text-primary text)
2141 (when x-select-enable-clipboard
99b631c8
KH
2142 (x-set-selection 'CLIPBOARD text)
2143 (setq x-last-selected-text-clipboard text))
ae10d597 2144 )
492878e4 2145
c7d9df18
KH
2146(defvar x-select-request-type nil
2147 "*Data type request for X selection.
2148The value is nil, one of the following data types, or a list of them:
2149 `COMPOUND_TEXT', `UTF8_STRING', `STRING', `TEXT'
2150
2151If the value is nil, try `COMPOUND_TEXT' and `UTF8_STRING', and
2152use the more appropriate result. If both fail, try `STRING', and
2153then `TEXT'.
2154
2155If the value is one of the above symbols, try only the specified
2156type.
2157
2158If the value is a list of them, try each of them in the specified
2159order until succeed.")
2160
2161;; Helper function for x-selection-value. Select UTF8 or CTEXT
2162;; whichever is more appropriate. Here, we use this heurisitcs.
2163;;
2164;; (1) If their lengthes are different, select the longer one. This
2165;; is because an X client may just cut off unsupported characters.
2166;;
2167;; (2) Otherwise, if the Nth character of CTEXT is an ASCII
2168;; character that is different from the Nth character of UTF8,
2169;; select UTF8. This is because an X client may replace unsupported
2170;; characters with some ASCII character (typically ` ' or `?') in
2171;; CTEXT.
2172;;
2173;; (3) Otherwise, select CTEXT. This is because legacy charsets are
2174;; better for the current Emacs, especially when the selection owner
2175;; is also Emacs.
2176
2177(defun x-select-utf8-or-ctext (utf8 ctext)
2178 (let ((len-utf8 (length utf8))
2179 (len-ctext (length ctext))
2180 (selected ctext)
2181 (i 0)
2182 char)
2183 (if (/= len-utf8 len-ctext)
2184 (if (> len-utf8 len-ctext) utf8 ctext)
b040ac64
KH
2185 (let ((result (compare-strings utf8 0 len-utf8 ctext 0 len-ctext)))
2186 (if (or (eq result t)
2187 (>= (aref ctext (1- (abs result))) 128))
2188 ctext
2189 utf8)))))
c7d9df18 2190
d8338794
KH
2191;; Get a selection value of type TYPE by calling x-get-selection with
2192;; an appropiate DATA-TYPE argument decidd by `x-select-request-type'.
2193;; The return value is already decoded. If x-get-selection causes an
2194;; error, this function return nil.
2195
c7d9df18
KH
2196(defun x-selection-value (type)
2197 (let (text)
2198 (cond ((null x-select-request-type)
2199 (let (utf8 ctext utf8-coding)
2200 ;; We try both UTF8_STRING and COMPOUND_TEXT, and choose
2201 ;; the more appropriate one. If both fail, try STRING.
2202
2203 ;; At first try UTF8_STRING.
2204 (setq utf8 (condition-case nil
2205 (x-get-selection type 'UTF8_STRING)
2206 (error nil))
2207 utf8-coding last-coding-system-used)
2208 (if utf8
3ff05361 2209 ;; If it is a local selection, or it contains only
ef99df9a
KH
2210 ;; ASCII characers, choose it.
2211 (if (or (not (get-text-property 0 'foreign-selection utf8))
2212 (= (length utf8) (string-bytes utf8)))
c7d9df18
KH
2213 (setq text utf8)))
2214 ;; If not yet decided, try COMPOUND_TEXT.
2215 (if (not text)
2216 (if (setq ctext (condition-case nil
2217 (x-get-selection type 'COMPOUND_TEXT)
2218 (error nil)))
2219 ;; If UTF8_STRING was also successful, choose the
2220 ;; more appropriate one from UTF8 and CTEXT.
2221 (if utf8
2222 (setq text (x-select-utf8-or-ctext utf8 ctext))
2223 ;; Othewise, choose CTEXT.
c3ff5bc1
KH
2224 (setq text ctext))
2225 (setq text utf8)))
c7d9df18
KH
2226 ;; If not yet decided, try STRING.
2227 (or text
2228 (setq text (condition-case nil
2229 (x-get-selection type 'STRING)
2230 (error nil))))
2231 (if (eq text utf8)
2232 (setq last-coding-system-used utf8-coding))))
2233
2234 ((consp x-select-request-type)
2235 (let ((tail x-select-request-type))
2236 (while (and tail (not text))
2237 (condition-case nil
2238 (setq text (x-get-selection type (car tail)))
2239 (error nil))
2240 (setq tail (cdr tail)))))
2241
2242 (t
2243 (condition-case nil
2244 (setq text (x-get-selection type x-select-request-type))
2245 (error nil))))
2246
2247 (if text
2248 (remove-text-properties 0 (length text) '(foreign-selection nil) text))
2249 text))
5fd6d89f 2250
4390cc9c 2251;;; Return the value of the current X selection.
ae10d597 2252;;; Consult the selection, and the cut buffer. Treat empty strings
4390cc9c 2253;;; as if they were unset.
d854d839
RS
2254;;; If this function is called twice and finds the same text,
2255;;; it returns nil the second time. This is so that a single
2256;;; selection won't be added to the kill ring over and over.
492878e4 2257(defun x-cut-buffer-or-selection-value ()
ae10d597 2258 (let (clip-text primary-text cut-text)
8ba13581 2259 (when x-select-enable-clipboard
c7d9df18 2260 (setq clip-text (x-selection-value 'CLIPBOARD))
ae10d597
PJ
2261 (if (string= clip-text "") (setq clip-text nil))
2262
2263 ;; Check the CLIPBOARD selection for 'newness', is it different
2264 ;; from what we remebered them to be last time we did a
2265 ;; cut/paste operation.
db95369b 2266 (setq clip-text
ae10d597
PJ
2267 (cond;; check clipboard
2268 ((or (not clip-text) (string= clip-text ""))
2269 (setq x-last-selected-text-clipboard nil))
2270 ((eq clip-text x-last-selected-text-clipboard) nil)
2271 ((string= clip-text x-last-selected-text-clipboard)
db95369b 2272 ;; Record the newer string,
ae10d597
PJ
2273 ;; so subsequent calls can use the `eq' test.
2274 (setq x-last-selected-text-clipboard clip-text)
2275 nil)
2276 (t
2277 (setq x-last-selected-text-clipboard clip-text))))
2278 )
8ba13581 2279
c7d9df18 2280 (setq primary-text (x-selection-value 'PRIMARY))
ae10d597
PJ
2281 ;; Check the PRIMARY selection for 'newness', is it different
2282 ;; from what we remebered them to be last time we did a
2283 ;; cut/paste operation.
db95369b 2284 (setq primary-text
ae10d597
PJ
2285 (cond;; check primary selection
2286 ((or (not primary-text) (string= primary-text ""))
2287 (setq x-last-selected-text-primary nil))
2288 ((eq primary-text x-last-selected-text-primary) nil)
2289 ((string= primary-text x-last-selected-text-primary)
db95369b 2290 ;; Record the newer string,
ae10d597
PJ
2291 ;; so subsequent calls can use the `eq' test.
2292 (setq x-last-selected-text-primary primary-text)
2293 nil)
2294 (t
2295 (setq x-last-selected-text-primary primary-text))))
1be7f9b0 2296
ae10d597 2297 (setq cut-text (x-get-cut-buffer 0))
f6c7b4e7 2298
ae10d597
PJ
2299 ;; Check the x cut buffer for 'newness', is it different
2300 ;; from what we remebered them to be last time we did a
2301 ;; cut/paste operation.
db95369b 2302 (setq cut-text
eb5ad242 2303 (cond;; check cut buffer
ae10d597
PJ
2304 ((or (not cut-text) (string= cut-text ""))
2305 (setq x-last-selected-text-cut nil))
eb5ad242
KH
2306 ;; This short cut doesn't work because x-get-cut-buffer
2307 ;; always returns a newly created string.
2308 ;; ((eq cut-text x-last-selected-text-cut) nil)
2309 ((string= cut-text x-last-selected-text-cut-encoded)
2310 ;; See the comment above. No need of this recording.
db95369b 2311 ;; Record the newer string,
ae10d597 2312 ;; so subsequent calls can use the `eq' test.
eb5ad242
KH
2313 ;; (setq x-last-selected-text-cut cut-text)
2314 nil)
2315 (t
2316 (setq x-last-selected-text-cut-encoded cut-text
2317 x-last-selected-text-cut
2318 (decode-coding-string cut-text (or locale-coding-system
2319 'iso-latin-1))))))
ae10d597 2320
c7d9df18
KH
2321 ;; As we have done one selection, clear this now.
2322 (setq next-selection-coding-system nil)
2323
ae10d597
PJ
2324 ;; At this point we have recorded the current values for the
2325 ;; selection from clipboard (if we are supposed to) primary,
2326 ;; and cut buffer. So return the first one that has changed
2327 ;; (which is the first non-null one).
2328 ;;
2329 ;; NOTE: There will be cases where more than one of these has
2330 ;; changed and the new values differ. This indicates that
2331 ;; something like the following has happened since the last time
2332 ;; we looked at the selections: Application X set all the
2333 ;; selections, then Application Y set only one or two of them (say
2334 ;; just the cut-buffer). In this case since we don't have
2335 ;; timestamps there is no way to know what the 'correct' value to
2336 ;; return is. The nice thing to do would be to tell the user we
2337 ;; saw multiple possible selections and ask the user which was the
db95369b 2338 ;; one they wanted.
ae10d597
PJ
2339 ;; This code is still a big improvement because now the user can
2340 ;; futz with the current selection and get emacs to pay attention
2341 ;; to the cut buffer again (previously as soon as clipboard or
2342 ;; primary had been set the cut buffer would essentially never be
2343 ;; checked again).
2344 (or clip-text primary-text cut-text)
2345 ))
492878e4 2346
2fb263f6
JB
2347\f
2348;;; Do the actual X Windows setup here; the above code just defines
2349;;; functions and variables that we use now.
2350
2351(setq command-line-args (x-handle-args command-line-args))
800642d2
JB
2352
2353;;; Make sure we have a valid resource name.
2354(or (stringp x-resource-name)
2355 (let (i)
2356 (setq x-resource-name (invocation-name))
2357
2358 ;; Change any . or * characters in x-resource-name to hyphens,
2359 ;; so as not to choke when we use it in X resource queries.
2360 (while (setq i (string-match "[.*]" x-resource-name))
2361 (aset x-resource-name i ?-))))
2362
cf07d2bd
DL
2363(x-open-connection (or x-display-name
2364 (setq x-display-name (getenv "DISPLAY")))
2365 x-command-line-resources
2366 ;; Exit Emacs with fatal error if this fails.
2367 t)
2fb263f6 2368
ffe1dd7a 2369(setq frame-creation-function 'x-create-frame-with-faces)
3d80ef3f 2370
ef599142
RS
2371(setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
2372 x-cut-buffer-max))
2373
6acdd93e
KH
2374;; Setup the default fontset.
2375(setup-default-fontset)
2376
cf07d2bd
DL
2377;; Create the standard fontset.
2378(create-fontset-from-fontset-spec standard-fontset-spec t)
2379
2380;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...).
2381(create-fontset-from-x-resource)
2382
2383;; Try to create a fontset from a font specification which comes
2384;; from initial-frame-alist, default-frame-alist, or X resource.
2385;; A font specification in command line argument (i.e. -fn XXXX)
2386;; should be already in default-frame-alist as a `font'
2387;; parameter. However, any font specifications in site-start
2388;; library, user's init file (.emacs), and default.el are not
2389;; yet handled here.
2390
2391(let ((font (or (cdr (assq 'font initial-frame-alist))
2392 (cdr (assq 'font default-frame-alist))
2393 (x-get-resource "font" "Font")))
2394 xlfd-fields resolved-name)
2395 (if (and font
2396 (not (query-fontset font))
2397 (setq resolved-name (x-resolve-font-name font))
2398 (setq xlfd-fields (x-decompose-font-name font)))
2399 (if (string= "fontset" (aref xlfd-fields xlfd-regexp-registry-subnum))
2400 (new-fontset font (x-complement-fontset-spec xlfd-fields nil))
2401 ;; Create a fontset from FONT. The fontset name is
2402 ;; generated from FONT.
2403 (create-fontset-from-ascii-font font resolved-name "startup"))))
f90080d4 2404
5d20eba6
JB
2405;; Apply a geometry resource to the initial frame. Put it at the end
2406;; of the alist, so that anything specified on the command line takes
2407;; precedence.
e42a4b86
RS
2408(let* ((res-geometry (x-get-resource "geometry" "Geometry"))
2409 parsed)
5d20eba6 2410 (if res-geometry
e42a4b86
RS
2411 (progn
2412 (setq parsed (x-parse-geometry res-geometry))
9b4234ae
RS
2413 ;; If the resource specifies a position,
2414 ;; call the position and size "user-specified".
2415 (if (or (assq 'top parsed) (assq 'left parsed))
2416 (setq parsed (cons '(user-position . t)
2417 (cons '(user-size . t) parsed))))
e42a4b86
RS
2418 ;; All geometry parms apply to the initial frame.
2419 (setq initial-frame-alist (append initial-frame-alist parsed))
2420 ;; The size parms apply to all frames.
2421 (if (assq 'height parsed)
2422 (setq default-frame-alist
2423 (cons (cons 'height (cdr (assq 'height parsed)))
2424 default-frame-alist)))
2425 (if (assq 'width parsed)
2426 (setq default-frame-alist
2427 (cons (cons 'width (cdr (assq 'width parsed)))
2428 default-frame-alist))))))
5d20eba6 2429
88046be2 2430;; Check the reverseVideo resource.
800642d2
JB
2431(let ((case-fold-search t))
2432 (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
2433 (if (and rv
2434 (string-match "^\\(true\\|yes\\|on\\)$" rv))
2435 (setq default-frame-alist
2436 (cons '(reverse . t) default-frame-alist)))))
88046be2 2437
553624bf
RS
2438;; Set x-selection-timeout, measured in milliseconds.
2439(let ((res-selection-timeout
2440 (x-get-resource "selectionTimeout" "SelectionTimeout")))
5c2867e0 2441 (setq x-selection-timeout 20000)
553624bf
RS
2442 (if res-selection-timeout
2443 (setq x-selection-timeout (string-to-number res-selection-timeout))))
2444
3d80ef3f 2445(defun x-win-suspend-error ()
089bc712 2446 (error "Suspending an Emacs running under X makes no sense"))
c8c72d6b
JB
2447(add-hook 'suspend-hook 'x-win-suspend-error)
2448
492878e4
JB
2449;;; Arrange for the kill and yank functions to set and check the clipboard.
2450(setq interprogram-cut-function 'x-select-text)
2451(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
63c86e17 2452
0cc6db57
JB
2453;;; Turn off window-splitting optimization; X is usually fast enough
2454;;; that this is only annoying.
2455(setq split-window-keep-point t)
5cdb3f1e 2456
53631723 2457;; Don't show the frame name; that's redundant with X.
982fa4e5 2458(setq-default mode-line-frame-identification " ")
53631723 2459
c3ef5084
SM
2460;; Motif direct handling of f10 wasn't working right,
2461;; So temporarily we've turned it off in lwlib-Xm.c
2462;; and turned the Emacs f10 back on.
2463;; ;; Motif normally handles f10 itself, so don't try to handle it a second time.
2464;; (if (featurep 'motif)
2465;; (global-set-key [f10] 'ignore))
2466
2467;; Turn on support for mouse wheels.
2468(mouse-wheel-mode 1)
9541a441 2469
133aad74 2470
a5bfbd4e
JD
2471;; Enable CLIPBOARD copy/paste through menu bar commands.
2472(menu-bar-enable-clipboard)
2473
2474;; Override Paste so it looks at CLIPBOARD first.
2475(defun x-clipboard-yank ()
2476 "Insert the clipboard contents, or the last stretch of killed text."
2477 (interactive)
d8338794 2478 (let ((clipboard-text (x-selection-value 'CLIPBOARD))
a5bfbd4e
JD
2479 (x-select-enable-clipboard t))
2480 (if (and clipboard-text (> (length clipboard-text) 0))
2481 (kill-new clipboard-text))
2482 (yank)))
2483
2484(define-key menu-bar-edit-menu [paste]
2485 (cons "Paste" (cons "Paste text from clipboard or kill ring"
2486 'x-clipboard-yank)))
2487
133aad74
JD
2488;; Initiate drag and drop
2489(add-hook 'after-make-frame-functions 'x-dnd-init-frame)
2490(global-set-key [drag-n-drop] 'x-dnd-handle-drag-n-drop-event)
2491
ab5796a9 2492;;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78
5cdb3f1e 2493;;; x-win.el ends here