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