]> code.delx.au - gnu-emacs/blob - lisp/term/x-win.el
Update FSF's office address.
[gnu-emacs] / lisp / term / x-win.el
1 ;;; x-win.el --- parse switches controlling interface with X window system
2
3 ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
4
5 ;; Author: FSF
6 ;; Keywords: terminals
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Commentary:
26
27 ;; X-win.el: this file is loaded from ../lisp/startup.el when it recognizes
28 ;; that X windows are to be used. Command line switches are parsed and those
29 ;; pertaining to X are processed and removed from the command line. The
30 ;; X display is opened and hooks are set for popping up the initial window.
31
32 ;; startup.el will then examine startup files, and eventually call the hooks
33 ;; which create the first window (s).
34
35 ;;; Code:
36 \f
37 ;; These are the standard X switches from the Xt Initialize.c file of
38 ;; Release 4.
39
40 ;; Command line Resource Manager string
41
42 ;; +rv *reverseVideo
43 ;; +synchronous *synchronous
44 ;; -background *background
45 ;; -bd *borderColor
46 ;; -bg *background
47 ;; -bordercolor *borderColor
48 ;; -borderwidth .borderWidth
49 ;; -bw .borderWidth
50 ;; -display .display
51 ;; -fg *foreground
52 ;; -fn *font
53 ;; -font *font
54 ;; -foreground *foreground
55 ;; -geometry .geometry
56 ;; -i .iconType
57 ;; -itype .iconType
58 ;; -iconic .iconic
59 ;; -name .name
60 ;; -reverse *reverseVideo
61 ;; -rv *reverseVideo
62 ;; -selectionTimeout .selectionTimeout
63 ;; -synchronous *synchronous
64 ;; -xrm
65
66 ;; An alist of X options and the function which handles them. See
67 ;; ../startup.el.
68
69 (if (not (eq window-system 'x))
70 (error "%s: Loading x-win.el but not compiled for X" (invocation-name)))
71
72 (require 'frame)
73 (require 'mouse)
74 (require 'scroll-bar)
75 (require 'faces)
76 (require 'select)
77 (require 'menu-bar)
78
79 (defvar x-invocation-args)
80
81 (defvar x-command-line-resources nil)
82
83 ;; Handler for switches of the form "-switch value" or "-switch".
84 (defun x-handle-switch (switch)
85 (let ((aelt (assoc switch command-line-x-option-alist)))
86 (if aelt
87 (let ((param (nth 3 aelt))
88 (value (nth 4 aelt)))
89 (if value
90 (setq default-frame-alist
91 (cons (cons param value)
92 default-frame-alist))
93 (setq default-frame-alist
94 (cons (cons param
95 (car x-invocation-args))
96 default-frame-alist)
97 x-invocation-args (cdr x-invocation-args)))))))
98
99 ;; Handler for switches of the form "-switch n"
100 (defun x-handle-numeric-switch (switch)
101 (let ((aelt (assoc switch command-line-x-option-alist)))
102 (if aelt
103 (let ((param (nth 3 aelt)))
104 (setq default-frame-alist
105 (cons (cons param
106 (string-to-int (car x-invocation-args)))
107 default-frame-alist)
108 x-invocation-args
109 (cdr x-invocation-args))))))
110
111 ;; Make -iconic apply only to the initial frame!
112 (defun x-handle-iconic (switch)
113 (setq initial-frame-alist
114 (cons '(visibility . icon) initial-frame-alist)))
115
116 ;; Handle the -xrm option.
117 (defun x-handle-xrm-switch (switch)
118 (or (consp x-invocation-args)
119 (error "%s: missing argument to `%s' option" (invocation-name) switch))
120 (setq x-command-line-resources (car x-invocation-args))
121 (setq x-invocation-args (cdr x-invocation-args)))
122
123 ;; Handle the geometry option
124 (defun x-handle-geometry (switch)
125 (let ((geo (x-parse-geometry (car x-invocation-args))))
126 (setq initial-frame-alist
127 (append initial-frame-alist
128 (if (or (assq 'left geo) (assq 'top geo))
129 '((user-position . t)))
130 (if (or (assq 'height geo) (assq 'width geo))
131 '((user-size . t)))
132 geo)
133 x-invocation-args (cdr x-invocation-args))))
134
135 ;; Handle the -name and -rn options. Set the variable x-resource-name
136 ;; to the option's operand; if the switch was `-name', set the name of
137 ;; the initial frame, too.
138 (defun x-handle-name-rn-switch (switch)
139 (or (consp x-invocation-args)
140 (error "%s: missing argument to `%s' option" (invocation-name) switch))
141 (setq x-resource-name (car x-invocation-args)
142 x-invocation-args (cdr x-invocation-args))
143 (if (string= switch "-name")
144 (setq initial-frame-alist (cons (cons 'name x-resource-name)
145 initial-frame-alist))))
146
147 (defvar x-display-name nil
148 "The X display name specifying server and X frame.")
149
150 (defun x-handle-display (switch)
151 (setq x-display-name (car x-invocation-args)
152 x-invocation-args (cdr x-invocation-args)))
153
154 (defun x-handle-args (args)
155 "Process the X-related command line options in ARGS.
156 This is done before the user's startup file is loaded. They are copied to
157 `x-invocation-args', from which the X-related things are extracted, first
158 the switch (e.g., \"-fg\") in the following code, and possible values
159 \(e.g., \"black\") in the option handler code (e.g., x-handle-switch).
160 This function returns ARGS minus the arguments that have been processed."
161 ;; We use ARGS to accumulate the args that we don't handle here, to return.
162 (setq x-invocation-args args
163 args nil)
164 (while x-invocation-args
165 (let* ((this-switch (car x-invocation-args))
166 (orig-this-switch this-switch)
167 completion argval aelt handler)
168 (setq x-invocation-args (cdr x-invocation-args))
169 ;; Check for long options with attached arguments
170 ;; and separate out the attached option argument into argval.
171 (if (string-match "^--[^=]*=" this-switch)
172 (setq argval (substring this-switch (match-end 0))
173 this-switch (substring this-switch 0 (1- (match-end 0)))))
174 ;; Complete names of long options.
175 (if (string-match "^--" this-switch)
176 (progn
177 (setq completion (try-completion this-switch command-line-x-option-alist))
178 (if (eq completion t)
179 ;; Exact match for long option.
180 nil
181 (if (stringp completion)
182 (let ((elt (assoc completion command-line-x-option-alist)))
183 ;; Check for abbreviated long option.
184 (or elt
185 (error "Option `%s' is ambiguous" this-switch))
186 (setq this-switch completion))))))
187 (setq aelt (assoc this-switch command-line-x-option-alist))
188 (if aelt (setq handler (nth 2 aelt)))
189 (if handler
190 (if argval
191 (let ((x-invocation-args
192 (cons argval x-invocation-args)))
193 (funcall handler this-switch))
194 (funcall handler this-switch))
195 (setq args (cons orig-this-switch args)))))
196 (nreverse args))
197 \f
198 ;;
199 ;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them.
200 ;;
201
202 (defconst x-pointer-X-cursor 0)
203 (defconst x-pointer-arrow 2)
204 (defconst x-pointer-based-arrow-down 4)
205 (defconst x-pointer-based-arrow-up 6)
206 (defconst x-pointer-boat 8)
207 (defconst x-pointer-bogosity 10)
208 (defconst x-pointer-bottom-left-corner 12)
209 (defconst x-pointer-bottom-right-corner 14)
210 (defconst x-pointer-bottom-side 16)
211 (defconst x-pointer-bottom-tee 18)
212 (defconst x-pointer-box-spiral 20)
213 (defconst x-pointer-center-ptr 22)
214 (defconst x-pointer-circle 24)
215 (defconst x-pointer-clock 26)
216 (defconst x-pointer-coffee-mug 28)
217 (defconst x-pointer-cross 30)
218 (defconst x-pointer-cross-reverse 32)
219 (defconst x-pointer-crosshair 34)
220 (defconst x-pointer-diamond-cross 36)
221 (defconst x-pointer-dot 38)
222 (defconst x-pointer-dotbox 40)
223 (defconst x-pointer-double-arrow 42)
224 (defconst x-pointer-draft-large 44)
225 (defconst x-pointer-draft-small 46)
226 (defconst x-pointer-draped-box 48)
227 (defconst x-pointer-exchange 50)
228 (defconst x-pointer-fleur 52)
229 (defconst x-pointer-gobbler 54)
230 (defconst x-pointer-gumby 56)
231 (defconst x-pointer-hand1 58)
232 (defconst x-pointer-hand2 60)
233 (defconst x-pointer-heart 62)
234 (defconst x-pointer-icon 64)
235 (defconst x-pointer-iron-cross 66)
236 (defconst x-pointer-left-ptr 68)
237 (defconst x-pointer-left-side 70)
238 (defconst x-pointer-left-tee 72)
239 (defconst x-pointer-leftbutton 74)
240 (defconst x-pointer-ll-angle 76)
241 (defconst x-pointer-lr-angle 78)
242 (defconst x-pointer-man 80)
243 (defconst x-pointer-middlebutton 82)
244 (defconst x-pointer-mouse 84)
245 (defconst x-pointer-pencil 86)
246 (defconst x-pointer-pirate 88)
247 (defconst x-pointer-plus 90)
248 (defconst x-pointer-question-arrow 92)
249 (defconst x-pointer-right-ptr 94)
250 (defconst x-pointer-right-side 96)
251 (defconst x-pointer-right-tee 98)
252 (defconst x-pointer-rightbutton 100)
253 (defconst x-pointer-rtl-logo 102)
254 (defconst x-pointer-sailboat 104)
255 (defconst x-pointer-sb-down-arrow 106)
256 (defconst x-pointer-sb-h-double-arrow 108)
257 (defconst x-pointer-sb-left-arrow 110)
258 (defconst x-pointer-sb-right-arrow 112)
259 (defconst x-pointer-sb-up-arrow 114)
260 (defconst x-pointer-sb-v-double-arrow 116)
261 (defconst x-pointer-shuttle 118)
262 (defconst x-pointer-sizing 120)
263 (defconst x-pointer-spider 122)
264 (defconst x-pointer-spraycan 124)
265 (defconst x-pointer-star 126)
266 (defconst x-pointer-target 128)
267 (defconst x-pointer-tcross 130)
268 (defconst x-pointer-top-left-arrow 132)
269 (defconst x-pointer-top-left-corner 134)
270 (defconst x-pointer-top-right-corner 136)
271 (defconst x-pointer-top-side 138)
272 (defconst x-pointer-top-tee 140)
273 (defconst x-pointer-trek 142)
274 (defconst x-pointer-ul-angle 144)
275 (defconst x-pointer-umbrella 146)
276 (defconst x-pointer-ur-angle 148)
277 (defconst x-pointer-watch 150)
278 (defconst x-pointer-xterm 152)
279 \f
280 ;;
281 ;; Available colors
282 ;;
283
284 (defvar x-colors '("aquamarine"
285 "Aquamarine"
286 "medium aquamarine"
287 "MediumAquamarine"
288 "black"
289 "Black"
290 "blue"
291 "Blue"
292 "cadet blue"
293 "CadetBlue"
294 "cornflower blue"
295 "CornflowerBlue"
296 "dark slate blue"
297 "DarkSlateBlue"
298 "light blue"
299 "LightBlue"
300 "light steel blue"
301 "LightSteelBlue"
302 "medium blue"
303 "MediumBlue"
304 "medium slate blue"
305 "MediumSlateBlue"
306 "midnight blue"
307 "MidnightBlue"
308 "navy blue"
309 "NavyBlue"
310 "navy"
311 "Navy"
312 "sky blue"
313 "SkyBlue"
314 "slate blue"
315 "SlateBlue"
316 "steel blue"
317 "SteelBlue"
318 "coral"
319 "Coral"
320 "cyan"
321 "Cyan"
322 "firebrick"
323 "Firebrick"
324 "brown"
325 "Brown"
326 "gold"
327 "Gold"
328 "goldenrod"
329 "Goldenrod"
330 "green"
331 "Green"
332 "dark green"
333 "DarkGreen"
334 "dark olive green"
335 "DarkOliveGreen"
336 "forest green"
337 "ForestGreen"
338 "lime green"
339 "LimeGreen"
340 "medium sea green"
341 "MediumSeaGreen"
342 "medium spring green"
343 "MediumSpringGreen"
344 "pale green"
345 "PaleGreen"
346 "sea green"
347 "SeaGreen"
348 "spring green"
349 "SpringGreen"
350 "yellow green"
351 "YellowGreen"
352 "dark slate grey"
353 "DarkSlateGrey"
354 "dark slate gray"
355 "DarkSlateGray"
356 "dim grey"
357 "DimGrey"
358 "dim gray"
359 "DimGray"
360 "light grey"
361 "LightGrey"
362 "light gray"
363 "LightGray"
364 "gray"
365 "grey"
366 "Gray"
367 "Grey"
368 "khaki"
369 "Khaki"
370 "magenta"
371 "Magenta"
372 "maroon"
373 "Maroon"
374 "orange"
375 "Orange"
376 "orchid"
377 "Orchid"
378 "dark orchid"
379 "DarkOrchid"
380 "medium orchid"
381 "MediumOrchid"
382 "pink"
383 "Pink"
384 "plum"
385 "Plum"
386 "red"
387 "Red"
388 "indian red"
389 "IndianRed"
390 "medium violet red"
391 "MediumVioletRed"
392 "orange red"
393 "OrangeRed"
394 "violet red"
395 "VioletRed"
396 "salmon"
397 "Salmon"
398 "sienna"
399 "Sienna"
400 "tan"
401 "Tan"
402 "thistle"
403 "Thistle"
404 "turquoise"
405 "Turquoise"
406 "dark turquoise"
407 "DarkTurquoise"
408 "medium turquoise"
409 "MediumTurquoise"
410 "violet"
411 "Violet"
412 "blue violet"
413 "BlueViolet"
414 "wheat"
415 "Wheat"
416 "white"
417 "White"
418 "yellow"
419 "Yellow"
420 "green yellow"
421 "GreenYellow")
422 "The list of X colors from the `rgb.txt' file.")
423
424 (defun x-defined-colors (&optional frame)
425 "Return a list of colors supported for a particular frame.
426 The argument FRAME specifies which frame to try.
427 The value may be different for frames on different X displays."
428 (or frame (setq frame (selected-frame)))
429 (let ((all-colors x-colors)
430 (this-color nil)
431 (defined-colors nil))
432 (while all-colors
433 (setq this-color (car all-colors)
434 all-colors (cdr all-colors))
435 (and (face-color-supported-p frame this-color t)
436 (setq defined-colors (cons this-color defined-colors))))
437 defined-colors))
438 \f
439 ;;;; Function keys
440
441 (defun iconify-or-deiconify-frame ()
442 "Iconify the selected frame, or deiconify if it's currently an icon."
443 (interactive)
444 (if (eq (cdr (assq 'visibility (frame-parameters))) t)
445 (iconify-frame)
446 (make-frame-visible)))
447
448 (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
449 global-map)
450
451 ;; Map certain keypad keys into ASCII characters
452 ;; that people usually expect.
453 (define-key function-key-map [backspace] [127])
454 (define-key function-key-map [delete] [127])
455 (define-key function-key-map [tab] [?\t])
456 (define-key function-key-map [linefeed] [?\n])
457 (define-key function-key-map [clear] [?\C-l])
458 (define-key function-key-map [return] [?\C-m])
459 (define-key function-key-map [escape] [?\e])
460 (define-key function-key-map [M-backspace] [?\M-\d])
461 (define-key function-key-map [M-delete] [?\M-\d])
462 (define-key function-key-map [M-tab] [?\M-\t])
463 (define-key function-key-map [M-linefeed] [?\M-\n])
464 (define-key function-key-map [M-clear] [?\M-\C-l])
465 (define-key function-key-map [M-return] [?\M-\C-m])
466 (define-key function-key-map [M-escape] [?\M-\e])
467
468 ;; These tell read-char how to convert
469 ;; these special chars to ASCII.
470 (put 'backspace 'ascii-character 127)
471 (put 'delete 'ascii-character 127)
472 (put 'tab 'ascii-character ?\t)
473 (put 'linefeed 'ascii-character ?\n)
474 (put 'clear 'ascii-character 12)
475 (put 'return 'ascii-character 13)
476 (put 'escape 'ascii-character ?\e)
477
478 (defun vendor-specific-keysyms (vendor)
479 "Return the appropriate value of system-key-alist for VENDOR.
480 VENDOR is a string containing the name of the X Server's vendor,
481 as returned by (x-server-vendor)."
482 (cond ((string-equal vendor "Apollo Computer Inc.")
483 '((65280 . linedel)
484 (65281 . chardel)
485 (65282 . copy)
486 (65283 . cut)
487 (65284 . paste)
488 (65285 . move)
489 (65286 . grow)
490 (65287 . cmd)
491 (65288 . shell)
492 (65289 . leftbar)
493 (65290 . rightbar)
494 (65291 . leftbox)
495 (65292 . rightbox)
496 (65293 . upbox)
497 (65294 . downbox)
498 (65295 . pop)
499 (65296 . read)
500 (65297 . edit)
501 (65298 . save)
502 (65299 . exit)
503 (65300 . repeat)))
504 ((or (string-equal vendor "Hewlett-Packard Incorporated")
505 (string-equal vendor "Hewlett-Packard Company"))
506 '(( 168 . mute-acute)
507 ( 169 . mute-grave)
508 ( 170 . mute-asciicircum)
509 ( 171 . mute-diaeresis)
510 ( 172 . mute-asciitilde)
511 ( 175 . lira)
512 ( 190 . guilder)
513 ( 252 . block)
514 ( 256 . longminus)
515 (65388 . reset)
516 (65389 . system)
517 (65390 . user)
518 (65391 . clearline)
519 (65392 . insertline)
520 (65393 . deleteline)
521 (65394 . insertchar)
522 (65395 . deletechar)
523 (65396 . backtab)
524 (65397 . kp-backtab)))
525 ((or (string-equal vendor "X11/NeWS - Sun Microsystems Inc.")
526 (string-equal vendor "X Consortium"))
527 '((392976 . f36)
528 (392977 . f37)
529 (393056 . req)
530 ;; These are for Sun under X11R6
531 (393072 . props)
532 (393073 . front)
533 (393074 . copy)
534 (393075 . open)
535 (393076 . paste)
536 (393077 . cut)))
537 (t
538 ;; This is used by DEC's X server.
539 '((65280 . remove)))))
540
541 \f
542 ;;;; Selections and cut buffers
543
544 ;;; We keep track of the last text selected here, so we can check the
545 ;;; current selection against it, and avoid passing back our own text
546 ;;; from x-cut-buffer-or-selection-value.
547 (defvar x-last-selected-text nil)
548
549 ;;; It is said that overlarge strings are slow to put into the cut buffer.
550 ;;; Note this value is overridden below.
551 (defvar x-cut-buffer-max 20000
552 "Max number of characters to put in the cut buffer.")
553
554 (defvar x-select-enable-clipboard nil
555 "Non-nil means cutting and pasting uses the clipboard.
556 This is in addition to the primary selection.")
557
558 ;;; Make TEXT, a string, the primary X selection.
559 ;;; Also, set the value of X cut buffer 0, for backward compatibility
560 ;;; with older X applications.
561 ;;; gildea@lcs.mit.edu says it's not desirable to put kills
562 ;;; in the clipboard.
563 (defun x-select-text (text &optional push)
564 ;; Don't send the cut buffer too much text.
565 ;; It becomes slow, and if really big it causes errors.
566 (if (< (length text) x-cut-buffer-max)
567 (x-set-cut-buffer text push)
568 (x-set-cut-buffer "" push))
569 (x-set-selection 'PRIMARY text)
570 (if x-select-enable-clipboard
571 (x-set-selection 'CLIPBOARD text))
572 (setq x-last-selected-text text))
573
574 ;;; Return the value of the current X selection.
575 ;;; Consult the selection, then the cut buffer. Treat empty strings
576 ;;; as if they were unset.
577 (defun x-cut-buffer-or-selection-value ()
578 (let (text)
579
580 ;; Don't die if x-get-selection signals an error.
581 (condition-case c
582 (setq text (x-get-selection 'PRIMARY))
583 (error nil))
584 (if (string= text "") (setq text nil))
585
586 (if x-select-enable-clipboard
587 (condition-case c
588 (setq text (x-get-selection 'CLIPBOARD))
589 (error nil)))
590 (if (string= text "") (setq text nil))
591 (or text (setq text (x-get-cut-buffer 0)))
592 (if (string= text "") (setq text nil))
593
594 (cond
595 ((not text) nil)
596 ((eq text x-last-selected-text) nil)
597 ((string= text x-last-selected-text)
598 ;; Record the newer string, so subsequent calls can use the `eq' test.
599 (setq x-last-selected-text text)
600 nil)
601 (t
602 (setq x-last-selected-text text)))))
603
604 \f
605 ;;; Do the actual X Windows setup here; the above code just defines
606 ;;; functions and variables that we use now.
607
608 (setq command-line-args (x-handle-args command-line-args))
609
610 ;;; Make sure we have a valid resource name.
611 (or (stringp x-resource-name)
612 (let (i)
613 (setq x-resource-name (invocation-name))
614
615 ;; Change any . or * characters in x-resource-name to hyphens,
616 ;; so as not to choke when we use it in X resource queries.
617 (while (setq i (string-match "[.*]" x-resource-name))
618 (aset x-resource-name i ?-))))
619
620 ;; For the benefit of older Emacses (19.27 and earlier) that are sharing
621 ;; the same lisp directory, don't pass the third argument unless we seem
622 ;; to have the multi-display support.
623 (if (fboundp 'x-close-connection)
624 (x-open-connection (or x-display-name
625 (setq x-display-name (getenv "DISPLAY")))
626 x-command-line-resources
627 ;; Exit Emacs with fatal error if this fails.
628 t)
629 (x-open-connection (or x-display-name
630 (setq x-display-name (getenv "DISPLAY")))
631 x-command-line-resources))
632
633 (setq frame-creation-function 'x-create-frame-with-faces)
634
635 (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
636 x-cut-buffer-max))
637
638 ;; Sun expects the menu bar cut and paste commands to use the clipboard.
639 ;; This has ,? to match both on Sunos and on Solaris.
640 (if (string-match "Sun Microsystems,? Inc\\."
641 (x-server-vendor))
642 (menu-bar-enable-clipboard))
643
644 ;; Apply a geometry resource to the initial frame. Put it at the end
645 ;; of the alist, so that anything specified on the command line takes
646 ;; precedence.
647 (let* ((res-geometry (x-get-resource "geometry" "Geometry"))
648 parsed)
649 (if res-geometry
650 (progn
651 (setq parsed (x-parse-geometry res-geometry))
652 ;; If the resource specifies a position,
653 ;; call the position and size "user-specified".
654 (if (or (assq 'top parsed) (assq 'left parsed))
655 (setq parsed (cons '(user-position . t)
656 (cons '(user-size . t) parsed))))
657 ;; All geometry parms apply to the initial frame.
658 (setq initial-frame-alist (append initial-frame-alist parsed))
659 ;; The size parms apply to all frames.
660 (if (assq 'height parsed)
661 (setq default-frame-alist
662 (cons (cons 'height (cdr (assq 'height parsed)))
663 default-frame-alist)))
664 (if (assq 'width parsed)
665 (setq default-frame-alist
666 (cons (cons 'width (cdr (assq 'width parsed)))
667 default-frame-alist))))))
668
669 ;; Check the reverseVideo resource.
670 (let ((case-fold-search t))
671 (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
672 (if (and rv
673 (string-match "^\\(true\\|yes\\|on\\)$" rv))
674 (setq default-frame-alist
675 (cons '(reverse . t) default-frame-alist)))))
676
677 ;; Set x-selection-timeout, measured in milliseconds.
678 (let ((res-selection-timeout
679 (x-get-resource "selectionTimeout" "SelectionTimeout")))
680 (setq x-selection-timeout 20000)
681 (if res-selection-timeout
682 (setq x-selection-timeout (string-to-number res-selection-timeout))))
683
684 (defun x-win-suspend-error ()
685 (error "Suspending an emacs running under X makes no sense"))
686 (add-hook 'suspend-hook 'x-win-suspend-error)
687
688 ;;; Arrange for the kill and yank functions to set and check the clipboard.
689 (setq interprogram-cut-function 'x-select-text)
690 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
691
692 ;;; Turn off window-splitting optimization; X is usually fast enough
693 ;;; that this is only annoying.
694 (setq split-window-keep-point t)
695
696 ;; Don't show the frame name; that's redundant with X.
697 (setq-default mode-line-buffer-identification '("Emacs: %12b"))
698
699 ;;; x-win.el ends here