x-win.el 49.3 KB
Newer Older
1
;;; x-win.el --- parse relevant switches and set up for X  -*-coding: iso-2022-7bit;-*-
Erik Naggum's avatar
Erik Naggum committed
2

3
;; Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
Glenn Morris's avatar
Glenn Morris committed
4
;;   2008, 2009 Free Software Foundation, Inc.
Eric S. Raymond's avatar
Eric S. Raymond committed
5 6

;; Author: FSF
7
;; Keywords: terminals, i18n
Eric S. Raymond's avatar
Eric S. Raymond committed
8

Erik Naggum's avatar
Erik Naggum committed
9 10
;; This file is part of GNU Emacs.

11
;; GNU Emacs is free software: you can redistribute it and/or modify
Erik Naggum's avatar
Erik Naggum committed
12
;; it under the terms of the GNU General Public License as published by
13 14
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
Erik Naggum's avatar
Erik Naggum committed
15 16 17 18 19 20 21

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
22
;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
Jim Blandy's avatar
Jim Blandy committed
23

Eric S. Raymond's avatar
Eric S. Raymond committed
24
;;; Commentary:
Jim Blandy's avatar
Jim Blandy committed
25

26 27 28 29
;; X-win.el: this file defines functions to initialize the X window
;; system and process X-specific command line parameters before
;; creating the first X frame.

Chong Yidong's avatar
Chong Yidong committed
30 31 32 33
;; Beginning in Emacs 23, the act of loading this file should not have
;; the side effect of initializing the window system or processing
;; command line arguments (this file is now loaded in loadup.el).  See
;; the variables `handle-args-function-alist' and
34
;; `window-system-initialization-alist' for more details.
Jim Blandy's avatar
Jim Blandy committed
35 36

;; startup.el will then examine startup files, and eventually call the hooks
37
;; which create the first window(s).
Eric S. Raymond's avatar
Eric S. Raymond committed
38 39

;;; Code:
Jim Blandy's avatar
Jim Blandy committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

;; These are the standard X switches from the Xt Initialize.c file of
;; Release 4.

;; Command line		Resource Manager string

;; +rv			*reverseVideo
;; +synchronous		*synchronous
;; -background		*background
;; -bd			*borderColor
;; -bg			*background
;; -bordercolor		*borderColor
;; -borderwidth		.borderWidth
;; -bw			.borderWidth
;; -display		.display
;; -fg			*foreground
;; -fn			*font
;; -font		*font
;; -foreground		*foreground
;; -geometry		.geometry
;; -iconic		.iconic
;; -name		.name
;; -reverse		*reverseVideo
;; -rv			*reverseVideo
;; -selectionTimeout    .selectionTimeout
;; -synchronous		*synchronous
;; -xrm

;; An alist of X options and the function which handles them.  See
;; ../startup.el.

71
(if (not (fboundp 'x-create-frame))
72
    (error "%s: Loading x-win.el but not compiled for X" (invocation-name)))
73

Jim Blandy's avatar
Jim Blandy committed
74
(require 'frame)
Jim Blandy's avatar
Jim Blandy committed
75
(require 'mouse)
76
(require 'scroll-bar)
77 78
(require 'faces)
(require 'select)
Richard M. Stallman's avatar
Richard M. Stallman committed
79
(require 'menu-bar)
80
(require 'fontset)
Kenichi Handa's avatar
Kenichi Handa committed
81
(require 'x-dnd)
Jim Blandy's avatar
Jim Blandy committed
82

83
(defvar x-invocation-args)
84 85 86 87
(defvar x-keysym-table)
(defvar x-selection-timeout)
(defvar x-session-id)
(defvar x-session-previous-id)
88

89 90 91
(defun x-handle-no-bitmap-icon (switch)
  (setq default-frame-alist (cons '(icon-type) default-frame-alist)))

92 93 94 95
;; Handle the --parent-id option.
(defun x-handle-parent-id (switch)
  (or (consp x-invocation-args)
      (error "%s: missing argument to `%s' option" (invocation-name) switch))
96 97 98 99 100
  (setq initial-frame-alist (cons
                             (cons 'parent-id
                                   (string-to-number (car x-invocation-args)))
                             initial-frame-alist)
        x-invocation-args (cdr x-invocation-args)))
101

Jan Djärv's avatar
Jan Djärv committed
102 103 104 105 106 107 108 109 110
;; Handle the --smid switch.  This is used by the session manager
;; to give us back our session id we had on the previous run.
(defun x-handle-smid (switch)
  (or (consp x-invocation-args)
      (error "%s: missing argument to `%s' option" (invocation-name) switch))
  (setq x-session-previous-id (car x-invocation-args)
	x-invocation-args (cdr x-invocation-args)))

(defvar emacs-save-session-functions nil
111 112
  "Special hook run when a save-session event occurs.
The functions do not get any argument.
Jan Djärv's avatar
Jan Djärv committed
113 114 115 116 117 118 119 120 121 122
Functions can return non-nil to inform the session manager that the
window system shutdown should be aborted.

See also `emacs-session-save'.")

(defun emacs-session-filename (session-id)
  "Construct a filename to save the session in based on SESSION-ID.
If the directory ~/.emacs.d exists, we make a filename in there, otherwise
a file in the home directory."
  (let ((basename (concat "session." session-id))
123
	(emacs-dir user-emacs-directory))
Jan Djärv's avatar
Jan Djärv committed
124 125 126
    (expand-file-name (if (file-directory-p emacs-dir)
			  (concat emacs-dir basename)
			(concat "~/.emacs-" basename)))))
127

Jan Djärv's avatar
Jan Djärv committed
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
(defun emacs-session-save ()
  "This function is called when the window system is shutting down.
If this function returns non-nil, the window system shutdown is cancelled.

When a session manager tells Emacs that the window system is shutting
down, this function is called.  It calls the functions in the hook
`emacs-save-session-functions'.  Functions are called with the current
buffer set to a temporary buffer.  Functions should use `insert' to insert
lisp code to save the session state.  The buffer is saved
in a file in the home directory of the user running Emacs.  The file
is evaluated when Emacs is restarted by the session manager.

If any of the functions returns non-nil, no more functions are called
and this function returns non-nil.  This will inform the session manager
that it should abort the window system shutdown."
  (let ((filename (emacs-session-filename x-session-id))
	(buf (get-buffer-create (concat " *SES " x-session-id))))
    (when (file-exists-p filename)
      (delete-file filename))
    (with-current-buffer buf
      (let ((cancel-shutdown (condition-case nil
149
				 ;; A return of t means cancel the shutdown.
150
				 (run-hook-with-args-until-success
Jan Djärv's avatar
Jan Djärv committed
151 152 153 154 155 156 157
				  'emacs-save-session-functions)
			       (error t))))
	(unless cancel-shutdown
	  (write-file filename))
	(kill-buffer buf)
	cancel-shutdown))))

158
(defun emacs-session-restore (previous-session-id)
Jan Djärv's avatar
Jan Djärv committed
159 160 161
  "Restore the Emacs session if started by a session manager.
The file saved by `emacs-session-save' is evaluated and deleted if it
exists."
162
  (let ((filename (emacs-session-filename previous-session-id)))
Jan Djärv's avatar
Jan Djärv committed
163 164 165 166 167
    (when (file-exists-p filename)
      (load-file filename)
      (delete-file filename)
      (message "Restored session data"))))

168 169


Jim Blandy's avatar
Jim Blandy committed
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251

;;
;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them.
;;

(defconst x-pointer-X-cursor 0)
(defconst x-pointer-arrow 2)
(defconst x-pointer-based-arrow-down 4)
(defconst x-pointer-based-arrow-up 6)
(defconst x-pointer-boat 8)
(defconst x-pointer-bogosity 10)
(defconst x-pointer-bottom-left-corner 12)
(defconst x-pointer-bottom-right-corner 14)
(defconst x-pointer-bottom-side 16)
(defconst x-pointer-bottom-tee 18)
(defconst x-pointer-box-spiral 20)
(defconst x-pointer-center-ptr 22)
(defconst x-pointer-circle 24)
(defconst x-pointer-clock 26)
(defconst x-pointer-coffee-mug 28)
(defconst x-pointer-cross 30)
(defconst x-pointer-cross-reverse 32)
(defconst x-pointer-crosshair 34)
(defconst x-pointer-diamond-cross 36)
(defconst x-pointer-dot 38)
(defconst x-pointer-dotbox 40)
(defconst x-pointer-double-arrow 42)
(defconst x-pointer-draft-large 44)
(defconst x-pointer-draft-small 46)
(defconst x-pointer-draped-box 48)
(defconst x-pointer-exchange 50)
(defconst x-pointer-fleur 52)
(defconst x-pointer-gobbler 54)
(defconst x-pointer-gumby 56)
(defconst x-pointer-hand1 58)
(defconst x-pointer-hand2 60)
(defconst x-pointer-heart 62)
(defconst x-pointer-icon 64)
(defconst x-pointer-iron-cross 66)
(defconst x-pointer-left-ptr 68)
(defconst x-pointer-left-side 70)
(defconst x-pointer-left-tee 72)
(defconst x-pointer-leftbutton 74)
(defconst x-pointer-ll-angle 76)
(defconst x-pointer-lr-angle 78)
(defconst x-pointer-man 80)
(defconst x-pointer-middlebutton 82)
(defconst x-pointer-mouse 84)
(defconst x-pointer-pencil 86)
(defconst x-pointer-pirate 88)
(defconst x-pointer-plus 90)
(defconst x-pointer-question-arrow 92)
(defconst x-pointer-right-ptr 94)
(defconst x-pointer-right-side 96)
(defconst x-pointer-right-tee 98)
(defconst x-pointer-rightbutton 100)
(defconst x-pointer-rtl-logo 102)
(defconst x-pointer-sailboat 104)
(defconst x-pointer-sb-down-arrow 106)
(defconst x-pointer-sb-h-double-arrow 108)
(defconst x-pointer-sb-left-arrow 110)
(defconst x-pointer-sb-right-arrow 112)
(defconst x-pointer-sb-up-arrow 114)
(defconst x-pointer-sb-v-double-arrow 116)
(defconst x-pointer-shuttle 118)
(defconst x-pointer-sizing 120)
(defconst x-pointer-spider 122)
(defconst x-pointer-spraycan 124)
(defconst x-pointer-star 126)
(defconst x-pointer-target 128)
(defconst x-pointer-tcross 130)
(defconst x-pointer-top-left-arrow 132)
(defconst x-pointer-top-left-corner 134)
(defconst x-pointer-top-right-corner 136)
(defconst x-pointer-top-side 138)
(defconst x-pointer-top-tee 140)
(defconst x-pointer-trek 142)
(defconst x-pointer-ul-angle 144)
(defconst x-pointer-umbrella 146)
(defconst x-pointer-ur-angle 148)
(defconst x-pointer-watch 150)
(defconst x-pointer-xterm 152)
252
(defconst x-pointer-invisible 255)
Jim Blandy's avatar
Jim Blandy committed
253

254

255 256
(defvar x-colors)

257
(defun xw-defined-colors (&optional frame)
Eli Zaretskii's avatar
Eli Zaretskii committed
258
  "Internal function called by `defined-colors'."
259
  (or frame (setq frame (selected-frame)))
Jim Blandy's avatar
Jim Blandy committed
260 261 262 263 264 265
  (let ((all-colors x-colors)
	(this-color nil)
	(defined-colors nil))
    (while all-colors
      (setq this-color (car all-colors)
	    all-colors (cdr all-colors))
266
      (and (color-supported-p this-color frame t)
Jim Blandy's avatar
Jim Blandy committed
267 268 269
	   (setq defined-colors (cons this-color defined-colors))))
    defined-colors))

Jim Blandy's avatar
Jim Blandy committed
270 271
;;;; Function keys

272 273 274 275 276 277 278 279 280 281 282
(defvar x-alternatives-map
  (let ((map (make-sparse-keymap)))
    ;; Map certain keypad keys into ASCII characters that people usually expect.
    (define-key map [M-backspace] [?\M-\d])
    (define-key map [M-delete] [?\M-\d])
    (define-key map [M-tab] [?\M-\t])
    (define-key map [M-linefeed] [?\M-\n])
    (define-key map [M-clear] [?\M-\C-l])
    (define-key map [M-return] [?\M-\C-m])
    (define-key map [M-escape] [?\M-\e])
    (define-key map [iso-lefttab] [backtab])
283
    (define-key map [S-iso-lefttab] [backtab])
284 285 286
    map)
  "Keymap of possible alternative meanings for some keys.")

287
(defun x-setup-function-keys (frame)
Eli Zaretskii's avatar
Eli Zaretskii committed
288
  "Set up `function-key-map' on the graphical frame FRAME."
289 290 291 292 293
  ;; Don't do this twice on the same display, or it would break
  ;; normal-erase-is-backspace-mode.
  (unless (terminal-parameter frame 'x-setup-function-keys)
    ;; Map certain keypad keys into ASCII characters that people usually expect.
    (with-selected-frame frame
294 295 296
      (let ((map (copy-keymap x-alternatives-map)))
        (set-keymap-parent map (keymap-parent local-function-key-map))
        (set-keymap-parent local-function-key-map map)))
297
    (set-terminal-parameter frame 'x-setup-function-keys t)))
298 299 300

;;;; Keysyms

301
(defun vendor-specific-keysyms (vendor)
302
  "Return the appropriate value of `system-key-alist' for VENDOR.
303
VENDOR is a string containing the name of the X Server's vendor,
304
as returned by `x-server-vendor'."
305
  (cond ((or (string-equal vendor "Hewlett-Packard Incorporated")
306
	     (string-equal vendor "Hewlett-Packard Company"))
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
	 '((  168 . mute-acute)
	   (  169 . mute-grave)
	   (  170 . mute-asciicircum)
	   (  171 . mute-diaeresis)
	   (  172 . mute-asciitilde)
	   (  175 . lira)
	   (  190 . guilder)
	   (  252 . block)
	   (  256 . longminus)
	   (65388 . reset)
	   (65389 . system)
	   (65390 . user)
	   (65391 . clearline)
	   (65392 . insertline)
	   (65393 . deleteline)
	   (65394 . insertchar)
	   (65395 . deletechar)
	   (65396 . backtab)
	   (65397 . kp-backtab)))
326
	;; Fixme: What about non-X11/NeWS sun server?
327 328
	((or (string-equal vendor "X11/NeWS - Sun Microsystems Inc.")
	     (string-equal vendor "X Consortium"))
Karl Heuer's avatar
Karl Heuer committed
329 330
	 '((392976 . f36)
	   (392977 . f37)
331 332 333 334 335 336 337 338 339 340 341 342
	   (393056 . req)
	   ;; These are for Sun under X11R6
	   (393072 . props)
	   (393073 . front)
	   (393074 . copy)
	   (393075 . open)
	   (393076 . paste)
	   (393077 . cut)))
	(t
	 ;; This is used by DEC's X server.
	 '((65280 . remove)))))

343
;; Latin-1
344 345
(let ((i 160))
  (while (< i 256)
346
    (puthash i i x-keysym-table)
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473
    (setq i (1+ i))))

;; Table from Kuhn's proposed additions to the `KEYSYM Encoding'
;; appendix to the X protocol definition.
(dolist
     (pair
      '(
	;; Latin-2
	(#x1a1 . ?,B!(B)
	(#x1a2 . ?,B"(B)
	(#x1a3 . ?,B#(B)
	(#x1a5 . ?,B%(B)
	(#x1a6 . ?,B&(B)
	(#x1a9 . ?,B)(B)
	(#x1aa . ?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
	(#x2b9 . ?,C9(B)
	(#x2bb . ?,C;(B)
	(#x2bc . ?,C<(B)
	(#x2c5 . ?,CE(B)
	(#x2c6 . ?,CF(B)
	(#x2d5 . ?,CU(B)
	(#x2d8 . ?,CX(B)
	(#x2dd . ?,C](B)
	(#x2de . ?,C^(B)
	(#x2e5 . ?,Ce(B)
	(#x2e6 . ?,Cf(B)
	(#x2f5 . ?,Cu(B)
	(#x2f8 . ?,Cx(B)
	(#x2fd . ?,C}(B)
	(#x2fe . ?,C~(B)
	;; Latin-4
	(#x3a2 . ?,D"(B)
	(#x3a3 . ?,D#(B)
	(#x3a5 . ?,D%(B)
	(#x3a6 . ?,D&(B)
	(#x3aa . ?,D*(B)
	(#x3ab . ?,D+(B)
	(#x3ac . ?,D,(B)
	(#x3b3 . ?,D3(B)
	(#x3b5 . ?,D5(B)
	(#x3b6 . ?,D6(B)
	(#x3ba . ?,D:(B)
	(#x3bb . ?,D;(B)
	(#x3bc . ?,D<(B)
	(#x3bd . ?,D=(B)
	(#x3bf . ?,D?(B)
	(#x3c0 . ?,D@(B)
	(#x3c7 . ?,DG(B)
	(#x3cc . ?,DL(B)
	(#x3cf . ?,DO(B)
	(#x3d1 . ?,DQ(B)
	(#x3d2 . ?,DR(B)
	(#x3d3 . ?,DS(B)
	(#x3d9 . ?,DY(B)
	(#x3dd . ?,D](B)
	(#x3de . ?,D^(B)
	(#x3e0 . ?,D`(B)
	(#x3e7 . ?,Dg(B)
	(#x3ec . ?,Dl(B)
	(#x3ef . ?,Do(B)
	(#x3f1 . ?,Dq(B)
	(#x3f2 . ?,Dr(B)
	(#x3f3 . ?,Ds(B)
	(#x3f9 . ?,Dy(B)
	(#x3fd . ?,D}(B)
	(#x3fe . ?,D~(B)
	;; Kana: Fixme: needs conversion to Japanese charset -- seems
	;; to require jisx0213, for which the Unicode translation
	;; isn't clear.
Kenichi Handa's avatar
Kenichi Handa committed
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537
	(#x47e . ?(J~(B)
	(#x4a1 . ?$A!#(B)
	(#x4a2 . ?\$A!8(B)
	(#x4a3 . ?\$A!9(B)
	(#x4a4 . ?$A!"(B)
	(#x4a5 . ?$A!$(B)
	(#x4a6 . ?$A%r(B)
	(#x4a7 . ?$A%!(B)
	(#x4a8 . ?$A%#(B)
	(#x4a9 . ?$A%%(B)
	(#x4aa . ?$A%'(B)
	(#x4ab . ?$A%)(B)
	(#x4ac . ?$A%c(B)
	(#x4ad . ?$A%e(B)
	(#x4ae . ?$A%g(B)
	(#x4af . ?$A%C(B)
	(#x4b0 . ?$B!<(B)
	(#x4b1 . ?$A%"(B)
	(#x4b2 . ?$A%$(B)
	(#x4b3 . ?$A%&(B)
	(#x4b4 . ?$A%((B)
	(#x4b5 . ?$A%*(B)
	(#x4b6 . ?$A%+(B)
	(#x4b7 . ?$A%-(B)
	(#x4b8 . ?$A%/(B)
	(#x4b9 . ?$A%1(B)
	(#x4ba . ?$A%3(B)
	(#x4bb . ?$A%5(B)
	(#x4bc . ?$A%7(B)
	(#x4bd . ?$A%9(B)
	(#x4be . ?$A%;(B)
	(#x4bf . ?$A%=(B)
	(#x4c0 . ?$A%?(B)
	(#x4c1 . ?$A%A(B)
	(#x4c2 . ?$A%D(B)
	(#x4c3 . ?$A%F(B)
	(#x4c4 . ?$A%H(B)
	(#x4c5 . ?$A%J(B)
	(#x4c6 . ?$A%K(B)
	(#x4c7 . ?$A%L(B)
	(#x4c8 . ?$A%M(B)
	(#x4c9 . ?$A%N(B)
	(#x4ca . ?$A%O(B)
	(#x4cb . ?$A%R(B)
	(#x4cc . ?$A%U(B)
	(#x4cd . ?$A%X(B)
	(#x4ce . ?$A%[(B)
	(#x4cf . ?$A%^(B)
	(#x4d0 . ?$A%_(B)
	(#x4d1 . ?$A%`(B)
	(#x4d2 . ?$A%a(B)
	(#x4d3 . ?$A%b(B)
	(#x4d4 . ?$A%d(B)
	(#x4d5 . ?$A%f(B)
	(#x4d6 . ?$A%h(B)
	(#x4d7 . ?$A%i(B)
	(#x4d8 . ?$A%j(B)
	(#x4d9 . ?$A%k(B)
	(#x4da . ?$A%l(B)
	(#x4db . ?$A%m(B)
	(#x4dc . ?$A%o(B)
	(#x4dd . ?$A%s(B)
	(#x4de . ?$B!+(B)
	(#x4df . ?$B!,(B)
538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587
	;; Arabic
	(#x5ac . ?,G,(B)
	(#x5bb . ?,G;(B)
	(#x5bf . ?,G?(B)
	(#x5c1 . ?,GA(B)
	(#x5c2 . ?,GB(B)
	(#x5c3 . ?,GC(B)
	(#x5c4 . ?,GD(B)
	(#x5c5 . ?,GE(B)
	(#x5c6 . ?,GF(B)
	(#x5c7 . ?,GG(B)
	(#x5c8 . ?,GH(B)
	(#x5c9 . ?,GI(B)
	(#x5ca . ?,GJ(B)
	(#x5cb . ?,GK(B)
	(#x5cc . ?,GL(B)
	(#x5cd . ?,GM(B)
	(#x5ce . ?,GN(B)
	(#x5cf . ?,GO(B)
	(#x5d0 . ?,GP(B)
	(#x5d1 . ?,GQ(B)
	(#x5d2 . ?,GR(B)
	(#x5d3 . ?,GS(B)
	(#x5d4 . ?,GT(B)
	(#x5d5 . ?,GU(B)
	(#x5d6 . ?,GV(B)
	(#x5d7 . ?,GW(B)
	(#x5d8 . ?,GX(B)
	(#x5d9 . ?,GY(B)
	(#x5da . ?,GZ(B)
	(#x5e0 . ?,G`(B)
	(#x5e1 . ?,Ga(B)
	(#x5e2 . ?,Gb(B)
	(#x5e3 . ?,Gc(B)
	(#x5e4 . ?,Gd(B)
	(#x5e5 . ?,Ge(B)
	(#x5e6 . ?,Gf(B)
	(#x5e7 . ?,Gg(B)
	(#x5e8 . ?,Gh(B)
	(#x5e9 . ?,Gi(B)
	(#x5ea . ?,Gj(B)
	(#x5eb . ?,Gk(B)
	(#x5ec . ?,Gl(B)
	(#x5ed . ?,Gm(B)
	(#x5ee . ?,Gn(B)
	(#x5ef . ?,Go(B)
	(#x5f0 . ?,Gp(B)
	(#x5f1 . ?,Gq(B)
	(#x5f2 . ?,Gr(B)
	;; Cyrillic
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617
	(#x680 . ?$,1)R(B)
	(#x681 . ?$,1)V(B)
	(#x682 . ?$,1)Z(B)
	(#x683 . ?$,1)\(B)
	(#x684 . ?$,1)b(B)
	(#x685 . ?$,1)n(B)
	(#x686 . ?$,1)p(B)
	(#x687 . ?$,1)r(B)
	(#x688 . ?$,1)v(B)
	(#x689 . ?$,1)x(B)
	(#x68a . ?$,1)z(B)
	(#x68c . ?$,1*8(B)
	(#x68d . ?$,1*B(B)
	(#x68e . ?$,1*H(B)
	(#x68f . ?$,1*N(B)
	(#x690 . ?$,1)S(B)
	(#x691 . ?$,1)W(B)
	(#x692 . ?$,1)[(B)
	(#x693 . ?$,1)](B)
	(#x694 . ?$,1)c(B)
	(#x695 . ?$,1)o(B)
	(#x696 . ?$,1)q(B)
	(#x697 . ?$,1)s(B)
	(#x698 . ?$,1)w(B)
	(#x699 . ?$,1)y(B)
	(#x69a . ?$,1){(B)
	(#x69c . ?$,1*9(B)
	(#x69d . ?$,1*C(B)
	(#x69e . ?$,1*I(B)
	(#x69f . ?$,1*O(B)
618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784
	(#x6a1 . ?,Lr(B)
	(#x6a2 . ?,Ls(B)
	(#x6a3 . ?,Lq(B)
	(#x6a4 . ?,Lt(B)
	(#x6a5 . ?,Lu(B)
	(#x6a6 . ?,Lv(B)
	(#x6a7 . ?,Lw(B)
	(#x6a8 . ?,Lx(B)
	(#x6a9 . ?,Ly(B)
	(#x6aa . ?,Lz(B)
	(#x6ab . ?,L{(B)
	(#x6ac . ?,L|(B)
	(#x6ae . ?,L~(B)
	(#x6af . ?,L(B)
	(#x6b0 . ?,Lp(B)
	(#x6b1 . ?,L"(B)
	(#x6b2 . ?,L#(B)
	(#x6b3 . ?,L!(B)
	(#x6b4 . ?,L$(B)
	(#x6b5 . ?,L%(B)
	(#x6b6 . ?,L&(B)
	(#x6b7 . ?,L'(B)
	(#x6b8 . ?,L((B)
	(#x6b9 . ?,L)(B)
	(#x6ba . ?,L*(B)
	(#x6bb . ?,L+(B)
	(#x6bc . ?,L,(B)
	(#x6be . ?,L.(B)
	(#x6bf . ?,L/(B)
	(#x6c0 . ?,Ln(B)
	(#x6c1 . ?,LP(B)
	(#x6c2 . ?,LQ(B)
	(#x6c3 . ?,Lf(B)
	(#x6c4 . ?,LT(B)
	(#x6c5 . ?,LU(B)
	(#x6c6 . ?,Ld(B)
	(#x6c7 . ?,LS(B)
	(#x6c8 . ?,Le(B)
	(#x6c9 . ?,LX(B)
	(#x6ca . ?,LY(B)
	(#x6cb . ?,LZ(B)
	(#x6cc . ?,L[(B)
	(#x6cd . ?,L\(B)
	(#x6ce . ?,L](B)
	(#x6cf . ?,L^(B)
	(#x6d0 . ?,L_(B)
	(#x6d1 . ?,Lo(B)
	(#x6d2 . ?,L`(B)
	(#x6d3 . ?,La(B)
	(#x6d4 . ?,Lb(B)
	(#x6d5 . ?,Lc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
	(#x8a1 . ?$,1|W(B)
Kenichi Handa's avatar
Kenichi Handa committed
785 786
	(#x8a2 . ?$A)0(B)
	(#x8a3 . ?$A)$(B)
787 788
	(#x8a4 . ?$,1{ (B)
	(#x8a5 . ?$,1{!(B)
Kenichi Handa's avatar
Kenichi Handa committed
789
	(#x8a6 . ?$A)&(B)
790 791 792 793 794 795 796 797 798 799
	(#x8a7 . ?$,1|A(B)
	(#x8a8 . ?$,1|C(B)
	(#x8a9 . ?$,1|D(B)
	(#x8aa . ?$,1|F(B)
	(#x8ab . ?$,1|;(B)
	(#x8ac . ?$,1|=(B)
	(#x8ad . ?$,1|>(B)
	(#x8ae . ?$,1|@(B)
	(#x8af . ?$,1|H(B)
	(#x8b0 . ?$,1|L(B)
Kenichi Handa's avatar
Kenichi Handa committed
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820
	(#x8bc . ?$A!\(B)
	(#x8bd . ?$A!Y(B)
	(#x8be . ?$A!](B)
	(#x8bf . ?$A!R(B)
	(#x8c0 . ?$A!`(B)
	(#x8c1 . ?$A!X(B)
	(#x8c2 . ?$A!^(B)
	(#x8c5 . ?$B"`(B)
	(#x8c8 . ?$(G"D(B)
	(#x8c9 . ?$(O"l(B)
	(#x8cd . ?$B"N(B)
	(#x8ce . ?$B"M(B)
	(#x8cf . ?$A!T(B)
	(#x8d6 . ?$A!L(B)
	(#x8da . ?$B">(B)
	(#x8db . ?$B"?(B)
	(#x8dc . ?$A!I(B)
	(#x8dd . ?$A!H(B)
	(#x8de . ?$A!D(B)
	(#x8df . ?$A!E(B)
	(#x8ef . ?$B"_(B)
821
	(#x8f6 . ?$,1!R(B)
Kenichi Handa's avatar
Kenichi Handa committed
822 823 824 825
	(#x8fb . ?$A!{(B)
	(#x8fc . ?$A!|(B)
	(#x8fd . ?$A!z(B)
	(#x8fe . ?$A!}(B)
826
	;; Special
Kenichi Handa's avatar
Kenichi Handa committed
827 828 829 830 831 832
	(#x9e0 . ?$A!t(B)
	(#x9e1 . ?$(C"F(B)
	(#x9e2 . ?$(GB*(B)
	(#x9e3 . ?$(GB-(B)
	(#x9e4 . ?$(GB.(B)
	(#x9e5 . ?$(GB+(B)
833
	(#x9e8 . ?$,1}d(B)
Kenichi Handa's avatar
Kenichi Handa committed
834 835 836 837 838 839
	(#x9e9 . ?$(GB,(B)
	(#x9ea . ?$A)<(B)
	(#x9eb . ?$A)4(B)
	(#x9ec . ?$A)0(B)
	(#x9ed . ?$A)8(B)
	(#x9ee . ?$A)`(B)
840 841
	(#x9ef . ?$,1|Z(B)
	(#x9f0 . ?$,1|[(B)
Kenichi Handa's avatar
Kenichi Handa committed
842
	(#x9f1 . ?$A)$(B)
843 844
	(#x9f2 . ?$,1|\(B)
	(#x9f3 . ?$,1|](B)
Kenichi Handa's avatar
Kenichi Handa committed
845 846 847 848 849
	(#x9f4 . ?$A)@(B)
	(#x9f5 . ?$A)H(B)
	(#x9f6 . ?$A)X(B)
	(#x9f7 . ?$A)P(B)
	(#x9f8 . ?$A)&(B)
850 851 852 853 854 855 856 857 858
	;; Publishing
	(#xaa1 . ?$,1rc(B)
	(#xaa2 . ?$,1rb(B)
	(#xaa3 . ?$,1rd(B)
	(#xaa4 . ?$,1re(B)
	(#xaa5 . ?$,1rg(B)
	(#xaa6 . ?$,1rh(B)
	(#xaa7 . ?$,1ri(B)
	(#xaa8 . ?$,1rj(B)
Kenichi Handa's avatar
Kenichi Handa committed
859 860 861 862 863 864 865
	(#xaa9 . ?$(G!7(B)
	(#xaaa . ?$(G!9(B)
	(#xaae . ?$A!-(B)
	(#xaaf . ?$(G!-(B)
	(#xab0 . ?$(O'x(B)
	(#xab1 . ?$(O'y(B)
	(#xab2 . ?$(O'z(B)
866 867 868 869 870
	(#xab3 . ?$,1v6(B)
	(#xab4 . ?$,1v7(B)
	(#xab5 . ?$,1v8(B)
	(#xab6 . ?$,1v9(B)
	(#xab7 . ?$,1v:(B)
Kenichi Handa's avatar
Kenichi Handa committed
871
	(#xab8 . ?$(G""(B)
872 873 874
	(#xabb . ?$,1rr(B)
	(#xabc . ?$,1{)(B)
	(#xabe . ?$,1{*(B)
Kenichi Handa's avatar
Kenichi Handa committed
875 876 877 878 879
	(#xac3 . ?$(C({(B)
	(#xac4 . ?$(C(|(B)
	(#xac5 . ?$(C(}(B)
	(#xac6 . ?$(C(~(B)
	(#xac9 . ?$(D"o(B)
880
	(#xaca . ?$,2"s(B)
Kenichi Handa's avatar
Kenichi Handa committed
881 882 883
	(#xacc . ?$(O##(B)
	(#xacd . ?$(O#!(B)
	(#xace . ?$A!p(B)
884
	(#xacf . ?$,2!o(B)
Kenichi Handa's avatar
Kenichi Handa committed
885 886 887 888
	(#xad0 . ?,F!(B)
	(#xad1 . ?,F"(B)
	(#xad2 . ?,Y4(B)
	(#xad3 . ?,Y!(B)
889
	(#xad4 . ?$,1u^(B)
Kenichi Handa's avatar
Kenichi Handa committed
890 891
	(#xad6 . ?$A!d(B)
	(#xad7 . ?$A!e(B)
892 893
	(#xad9 . ?$,2%](B)
	(#xadb . ?$,2!l(B)
Kenichi Handa's avatar
Kenichi Handa committed
894 895 896
	(#xadc . ?$(O#$(B)
	(#xadd . ?$(O#"(B)
	(#xade . ?$A!q(B)
897
	(#xadf . ?$,2!n(B)
Kenichi Handa's avatar
Kenichi Handa committed
898
	(#xae0 . ?$(O#?(B)
899 900
	(#xae1 . ?$,2!k(B)
	(#xae2 . ?$,2!m(B)
Kenichi Handa's avatar
Kenichi Handa committed
901 902 903 904
	(#xae3 . ?$A!w(B)
	(#xae4 . ?$(G!}(B)
	(#xae5 . ?$A!n(B)
	(#xae6 . ?$(O#@(B)
905
	(#xae7 . ?$,2!j(B)
Kenichi Handa's avatar
Kenichi Handa committed
906 907 908 909 910 911 912
	(#xae8 . ?$A!x(B)
	(#xae9 . ?$(G!~(B)
	(#xaea . ?$(C"P(B)
	(#xaeb . ?$(O-~(B)
	(#xaec . ?$(O&@(B)
	(#xaed . ?$(O&<(B)
	(#xaee . ?$(O&>(B)
913
	(#xaf0 . ?$,2%`(B)
Kenichi Handa's avatar
Kenichi Handa committed
914 915 916
	(#xaf1 . ?$B"w(B)
	(#xaf2 . ?$B"x(B)
	(#xaf3 . ?$(O'{(B)
917
	(#xaf4 . ?$,2%W(B)
Kenichi Handa's avatar
Kenichi Handa committed
918 919 920 921 922
	(#xaf5 . ?$B"t(B)
	(#xaf6 . ?$B"u(B)
	(#xaf7 . ?$A!a(B)
	(#xaf8 . ?$A!b(B)
	(#xaf9 . ?$(O&g(B)
923 924 925 926
	(#xafa . ?$,1zu(B)
	(#xafb . ?$,1uW(B)
	(#xafc . ?$,1s8(B)
	(#xafd . ?$,1rz(B)
Kenichi Handa's avatar
Kenichi Handa committed
927
	(#xafe . ?,Y%(B)
928 929 930
	;; APL
	(#xba3 . ?<)
	(#xba6 . ?>)
Kenichi Handa's avatar
Kenichi Handa committed
931 932
	(#xba8 . ?$A!E(B)
	(#xba9 . ?$A!D(B)
933
	(#xbc0 . ?,A/(B)
Kenichi Handa's avatar
Kenichi Handa committed
934 935
	(#xbc2 . ?$A!M(B)
	(#xbc3 . ?$A!I(B)
936 937 938 939 940
	(#xbc4 . ?$,1zj(B)
	(#xbc6 . ?_)
	(#xbca . ?$,1x8(B)
	(#xbcc . ?$,1|5(B)
	(#xbce . ?$,1yd(B)
Kenichi Handa's avatar
Kenichi Handa committed
941
	(#xbcf . ?$A!p(B)
942
	(#xbd3 . ?$,1zh(B)
Kenichi Handa's avatar
Kenichi Handa committed
943 944 945
	(#xbd6 . ?$A!H(B)
	(#xbd8 . ?$B"?(B)
	(#xbda . ?$B">(B)
946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159
	(#xbdc . ?$,1yb(B)
	(#xbfc . ?$,1yc(B)
	;; Hebrew
	(#xcdf . ?,H_(B)
	(#xce0 . ?,H`(B)
	(#xce1 . ?,Ha(B)
	(#xce2 . ?,Hb(B)
	(#xce3 . ?,Hc(B)
	(#xce4 . ?,Hd(B)
	(#xce5 . ?,He(B)
	(#xce6 . ?,Hf(B)
	(#xce7 . ?,Hg(B)
	(#xce8 . ?,Hh(B)
	(#xce9 . ?,Hi(B)
	(#xcea . ?,Hj(B)
	(#xceb . ?,Hk(B)
	(#xcec . ?,Hl(B)
	(#xced . ?,Hm(B)
	(#xcee . ?,Hn(B)
	(#xcef . ?,Ho(B)
	(#xcf0 . ?,Hp(B)
	(#xcf1 . ?,Hq(B)
	(#xcf2 . ?,Hr(B)
	(#xcf3 . ?,Hs(B)
	(#xcf4 . ?,Ht(B)
	(#xcf5 . ?,Hu(B)
	(#xcf6 . ?,Hv(B)
	(#xcf7 . ?,Hw(B)
	(#xcf8 . ?,Hx(B)
	(#xcf9 . ?,Hy(B)
	(#xcfa . ?,Hz(B)
	;; Thai
	(#xda1 . ?,T!(B)
	(#xda2 . ?,T"(B)
	(#xda3 . ?,T#(B)
	(#xda4 . ?,T$(B)
	(#xda5 . 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,1M9(B)
	(#xeff . ?$,1tI(B)
	;; Latin-5
	;; Latin-6
	;; Latin-7
	;; Latin-8
	;; Latin-9
	(#x13bc . ?,b<(B)
	(#x13bd . ?,b=(B)
Kenichi Handa's avatar
Kenichi Handa committed
1160
	(#x13be . ?,_/(B)
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193
	;; Currency
	(#x20a0 . ?$,1t@(B)
	(#x20a1 . ?$,1tA(B)
	(#x20a2 . ?$,1tB(B)
	(#x20a3 . ?$,1tC(B)
	(#x20a4 . ?$,1tD(B)
	(#x20a5 . ?$,1tE(B)
	(#x20a6 . ?$,1tF(B)
	(#x20a7 . ?$,1tG(B)
	(#x20a8 . ?$,1tH(B)
	(#x20aa . ?$,1tJ(B)
	(#x20ab . ?$,1tK(B)
	(#x20ac . ?,b$(B)))
  (puthash (car pair) (cdr pair) x-keysym-table))

;; The following keysym codes for graphics are listed in the document
;; as not having unicodes available:

;; #x08b1	TOP LEFT SUMMATION	Technical
;; #x08b2	BOTTOM LEFT SUMMATION	Technical
;; #x08b3	TOP VERTICAL SUMMATION CONNECTOR	Technical
;; #x08b4	BOTTOM VERTICAL SUMMATION CONNECTOR	Technical
;; #x08b5	TOP RIGHT SUMMATION	Technical
;; #x08b6	BOTTOM RIGHT SUMMATION	Technical
;; #x08b7	RIGHT MIDDLE SUMMATION	Technical
;; #x0aac	SIGNIFICANT BLANK SYMBOL	Publish
;; #x0abd	DECIMAL POINT	Publish
;; #x0abf	MARKER	Publish
;; #x0acb	TRADEMARK SIGN IN CIRCLE	Publish
;; #x0ada	HEXAGRAM	Publish
;; #x0aff	CURSOR	Publish
;; #x0dde	THAI MAIHANAKAT	Thai

Jim Blandy's avatar
Jim Blandy committed
1194 1195

;;;; Selections and cut buffers
Jim Blandy's avatar
Jim Blandy committed
1196

Stefan Monnier's avatar
Stefan Monnier committed
1197 1198 1199 1200 1201 1202
;; We keep track of the last text selected here, so we can check the
;; current selection against it, and avoid passing back our own text
;; from x-cut-buffer-or-selection-value.  We track all three
;; seperately in case another X application only sets one of them
;; (say the cut buffer) we aren't fooled by the PRIMARY or
;; CLIPBOARD selection staying the same.
1203 1204 1205
(defvar x-last-selected-text-clipboard nil
  "The value of the CLIPBOARD X selection last time we selected or
pasted text.")
1206
(defvar x-last-selected-text-primary nil
1207 1208
  "The value of the PRIMARY X selection last time we selected or
pasted text.")
1209
(defvar x-last-selected-text-cut nil
1210 1211 1212 1213 1214
  "The value of the X cut buffer last time we selected or pasted text.
The actual text stored in the X cut buffer is what encoded from this value.")
(defvar x-last-selected-text-cut-encoded nil
  "The value of the X cut buffer last time we selected or pasted text.
This is the actual text stored in the X cut buffer.")
1215 1216
(defvar x-last-cut-buffer-coding 'iso-latin-1
  "The coding we last used to encode/decode the text from the X cut buffer")
Jim Blandy's avatar
Jim Blandy committed
1217

Stefan Monnier's avatar
Stefan Monnier committed
1218 1219 1220
(defvar x-cut-buffer-max 20000 ; Note this value is overridden below.
  "Max number of characters to put in the cut buffer.
It is said that overlarge strings are slow to put into the cut buffer.")
1221

1222
(defcustom x-select-enable-clipboard nil
1223
  "Non-nil means cutting and pasting uses the clipboard.
Eli Zaretskii's avatar
Eli Zaretskii committed
1224 1225 1226 1227 1228
This is in addition to, but in preference to, the primary selection.

On MS-Windows, this is non-nil by default, since Windows does not
support other types of selections.  \(The primary selection that is
set by Emacs is not accessible to other programs on Windows.\)"
1229 1230
  :type 'boolean
  :group 'killing)
1231

1232 1233 1234 1235 1236
(defcustom x-select-enable-primary t
  "Non-nil means cutting and pasting uses the primary selection."
  :type 'boolean
  :group 'killing)

1237
(defun x-select-text (text &optional push)
Eli Zaretskii's avatar
Eli Zaretskii committed
1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250
  "Select TEXT, a string, according to the window system.

On X, put TEXT in the primary X selection.  For backward
compatibility with older X applications, set the value of X cut
buffer 0 as well, and if the optional argument PUSH is non-nil,
rotate the cut buffers.  If `x-select-enable-clipboard' is
non-nil, copy the text to the X clipboard as well.

On Windows, make TEXT the current selection.  If
`x-select-enable-clipboard' is non-nil, copy the text to the
clipboard as well.  The argument PUSH is ignored.

On Nextstep, put TEXT in the pasteboard; PUSH is ignored."
1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265
  ;; With multi-tty, this function may be called from a tty frame.
  (when (eq (framep (selected-frame)) 'x)
    ;; Don't send the cut buffer too much text.
    ;; It becomes slow, and if really big it causes errors.
    (cond ((>= (length text) x-cut-buffer-max)
           (x-set-cut-buffer "" push)
           (setq x-last-selected-text-cut ""
                 x-last-selected-text-cut-encoded ""))
          (t
           (setq x-last-selected-text-cut text
                 x-last-cut-buffer-coding 'iso-latin-1
                 x-last-selected-text-cut-encoded
                 ;; ICCCM says cut buffer always contain ISO-Latin-1
                 (encode-coding-string text 'iso-latin-1))
           (x-set-cut-buffer x-last-selected-text-cut-encoded push)))
1266 1267 1268
    (when x-select-enable-primary
      (x-set-selection 'PRIMARY text)
      (setq x-last-selected-text-primary text))
1269 1270 1271
    (when x-select-enable-clipboard
      (x-set-selection 'CLIPBOARD text)
      (setq x-last-selected-text-clipboard text))))
Jim Blandy's avatar
Jim Blandy committed
1272

1273 1274
(defvar x-select-request-type nil
  "*Data type request for X selection.
1275
The value is one of the following data types, a list of them, or nil:
1276 1277 1278 1279 1280 1281
  `COMPOUND_TEXT', `UTF8_STRING', `STRING', `TEXT'

If the value is one of the above symbols, try only the specified
type.

If the value is a list of them, try each of them in the specified
1282
order until succeed.
1283

1284 1285 1286
The value nil is the same as this list:
  \(UTF8_STRING COMPOUND_TEXT STRING)
")
1287

1288
;; Get a selection value of type TYPE by calling x-get-selection with
1289
;; an appropiate DATA-TYPE argument decided by `x-select-request-type'.
1290 1291 1292
;; The return value is already decoded.  If x-get-selection causes an
;; error, this function return nil.

1293
(defun x-selection-value (type)
1294 1295
  (let ((request-type (or x-select-request-type
			  '(UTF8_STRING COMPOUND_TEXT STRING)))
1296 1297 1298 1299 1300 1301 1302 1303 1304 1305
	text)
    (if (consp request-type)
	(while (and request-type (not text))
	  (condition-case nil
	      (setq text (x-get-selection type (car request-type)))
	    (error nil))
	  (setq request-type (cdr request-type)))
      (condition-case nil
	  (setq text (x-get-selection type request-type))
	(error nil)))
1306 1307 1308
    (if text
	(remove-text-properties 0 (length text) '(foreign-selection nil) text))
    text))
1309

Stefan Monnier's avatar
Stefan Monnier committed
1310 1311 1312 1313 1314 1315
;; Return the value of the current X selection.
;; Consult the selection, and the cut buffer.  Treat empty strings
;; as if they were unset.
;; If this function is called twice and finds the same text,
;; it returns nil the second time.  This is so that a single
;; selection won't be added to the kill ring over and over.
Jim Blandy's avatar
Jim Blandy committed
1316
(defun x-cut-buffer-or-selection-value ()
1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338
  ;; With multi-tty, this function may be called from a tty frame.
  (when (eq (framep (selected-frame)) 'x)
    (let (clip-text primary-text cut-text)
      (when x-select-enable-clipboard
        (setq clip-text (x-selection-value 'CLIPBOARD))
        (if (string= clip-text "") (setq clip-text nil))

        ;; Check the CLIPBOARD selection for 'newness', is it different
        ;; from what we remebered them to be last time we did a
        ;; cut/paste operation.
        (setq clip-text
              (cond ;; check clipboard
               ((or (not clip-text) (string= clip-text ""))
                (setq x-last-selected-text-clipboard nil))
               ((eq      clip-text x-last-selected-text-clipboard) nil)
               ((string= clip-text x-last-selected-text-clipboard)
                ;; Record the newer string,
                ;; so subsequent calls can use the `eq' test.
                (setq x-last-selected-text-clipboard clip-text)
                nil)
               (t (setq x-last-selected-text-clipboard clip-text)))))

1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355
      (when x-select-enable-primary
	(setq primary-text (x-selection-value 'PRIMARY))
	;; Check the PRIMARY selection for 'newness', is it different
	;; from what we remebered them to be last time we did a
	;; cut/paste operation.
	(setq primary-text
	      (cond ;; check primary selection
	       ((or (not primary-text) (string= primary-text ""))
		(setq x-last-selected-text-primary nil))
	       ((eq      primary-text x-last-selected-text-primary) nil)
	       ((string= primary-text x-last-selected-text-primary)
		;; Record the newer string,
		;; so subsequent calls can use the `eq' test.
		(setq x-last-selected-text-primary primary-text)
		nil)
	       (t
		(setq x-last-selected-text-primary primary-text)))))
1356 1357 1358 1359

      (setq cut-text (x-get-cut-buffer 0))

      ;; Check the x cut buffer for 'newness', is it different
1360 1361
      ;; from what we remebered them to be last time we did a
      ;; cut/paste operation.
1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414
      (setq cut-text
            (let ((next-coding (or next-selection-coding-system 'iso-latin-1)))
              (cond ;; check cut buffer
               ((or (not cut-text) (string= cut-text ""))
                (setq x-last-selected-text-cut nil))
               ;; This short cut doesn't work because x-get-cut-buffer
               ;; always returns a newly created string.
               ;; ((eq      cut-text x-last-selected-text-cut) nil)
               ((and (string= cut-text x-last-selected-text-cut-encoded)
                     (eq x-last-cut-buffer-coding next-coding))
                ;; See the comment above.  No need of this recording.
                ;; Record the newer string,
                ;; so subsequent calls can use the `eq' test.
                ;; (setq x-last-selected-text-cut cut-text)
                nil)
               (t
                (setq x-last-selected-text-cut-encoded cut-text
                      x-last-cut-buffer-coding next-coding
                      x-last-selected-text-cut
                      ;; ICCCM says cut buffer always contain ISO-Latin-1, but
                      ;; use next-selection-coding-system if not nil.
                      (decode-coding-string
                       cut-text next-coding))))))

      ;; As we have done one selection, clear this now.
      (setq next-selection-coding-system nil)

      ;; At this point we have recorded the current values for the
      ;; selection from clipboard (if we are supposed to) primary,
      ;; and cut buffer.  So return the first one that has changed
      ;; (which is the first non-null one).
      ;;
      ;; NOTE: There will be cases where more than one of these has
      ;; changed and the new values differ.  This indicates that
      ;; something like the following has happened since the last time
      ;; we looked at the selections: Application X set all the
      ;; selections, then Application Y set only one or two of them (say
      ;; just the cut-buffer).  In this case since we don't have
      ;; timestamps there is no way to know what the 'correct' value to
      ;; return is.  The nice thing to do would be to tell the user we
      ;; saw multiple possible selections and ask the user which was the
      ;; one they wanted.
      ;; This code is still a big improvement because now the user can
      ;; futz with the current selection and get emacs to pay attention
      ;; to the cut buffer again (previously as soon as clipboard or
      ;; primary had been set the cut buffer would essentially never be
      ;; checked again).
      (or clip-text primary-text cut-text)
      )))

;; Arrange for the kill and yank functions to set and check the clipboard.
(setq interprogram-cut-function 'x-select-text)
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
Jim Blandy's avatar
Jim Blandy committed
1415

1416 1417
(defun x-clipboard-yank ()
  "Insert the clipboard contents, or the last stretch of killed text."
Karoly Lorentey's avatar
Karoly Lorentey committed
1418
  (interactive "*")
1419
  (let ((clipboard-text (x-selection-value 'CLIPBOARD))
1420 1421 1422 1423
	(x-select-enable-clipboard t))
    (if (and clipboard-text (> (length clipboard-text) 0))
	(kill-new clipboard-text))
    (yank)))
1424

1425 1426
(declare-function accelerate-menu "xmenu.c" (&optional frame) t)

Karoly Lorentey's avatar
Karoly Lorentey committed
1427 1428 1429
(defun x-menu-bar-open (&optional frame)
  "Open the menu bar if `menu-bar-mode' is on. otherwise call `tmm-menubar'."
  (interactive "i")
1430 1431 1432
  (if (and menu-bar-mode
	   (fboundp 'accelerate-menu))
      (accelerate-menu frame)
Karoly Lorentey's avatar
Karoly Lorentey committed
1433
    (tmm-menubar)))
1434

Jim Blandy's avatar
Jim Blandy committed
1435

1436
;;; Window system initialization.
1437

1438
(defun x-win-suspend-error ()
1439 1440 1441
  ;; Don't allow suspending if any of the frames are X frames.
  (if (memq 'x (mapcar 'window-system (frame-list)))
      (error "Cannot suspend Emacs while running under X")))
1442

1443 1444 1445
(defvar x-initialized nil
  "Non-nil if the X window system has been initialized.")

1446 1447 1448 1449 1450
(declare-function x-open-connection "xfns.c"
		  (display &optional xrm-string must-succeed))
(declare-function x-server-max-request-size "xfns.c" (&optional terminal))
(declare-function x-get-resource "frame.c"
		  (attribute class &optional component subclass))
1451 1452 1453 1454
(declare-function x-parse-geometry "frame.c" (string))
(defvar x-resource-name)
(defvar x-display-name)
(defvar x-command-line-resources)
1455

1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468
(defun x-initialize-window-system ()
  "Initialize Emacs for X frames and open the first connection to an X server."
  ;; Make sure we have a valid resource name.
  (or (stringp x-resource-name)
      (let (i)
	(setq x-resource-name (invocation-name))

	;; Change any . or * characters in x-resource-name to hyphens,
	;; so as not to choke when we use it in X resource queries.
	(while (setq i (string-match "[.*]" x-resource-name))
	  (aset x-resource-name i ?-))))

  (x-open-connection (or x-display-name
1469
			 (setq x-display-name (or (getenv "DISPLAY" (selected-frame))
1470
						  (getenv "DISPLAY"))))
1471