428
+ − 1 ;;; select.el --- Lisp interface to windows selections.
+ − 2
+ − 3 ;; Copyright (C) 1998 Andy Piper.
+ − 4 ;; Copyright (C) 1990, 1997 Free Software Foundation, Inc.
+ − 5 ;; Copyright (C) 1995 Sun Microsystems.
851
+ − 6 ;; Copyright (C) 2002 Ben Wing.
428
+ − 7
+ − 8 ;; Maintainer: XEmacs Development Team
+ − 9 ;; Keywords: extensions, dumped
+ − 10
+ − 11 ;; This file is part of XEmacs.
+ − 12
+ − 13 ;; XEmacs is free software; you can redistribute it and/or modify it
+ − 14 ;; under the terms of the GNU General Public License as published by
+ − 15 ;; the Free Software Foundation; either version 2, or (at your option)
+ − 16 ;; any later version.
+ − 17
+ − 18 ;; XEmacs is distributed in the hope that it will be useful, but
+ − 19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
+ − 20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ − 21 ;; General Public License for more details.
+ − 22
+ − 23 ;; You should have received a copy of the GNU General Public License
444
+ − 24 ;; along with XEmacs; see the file COPYING. If not, write to the
428
+ − 25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ − 26 ;; Boston, MA 02111-1307, USA.
+ − 27
+ − 28 ;;; Synched up with: Not in FSF
+ − 29
+ − 30 ;;; Commentary:
+ − 31
444
+ − 32 ;; This file is dumped with XEmacs
428
+ − 33
+ − 34 ;;; Code:
+ − 35
2624
+ − 36 ;; We prefer UTF8_STRING to COMPOUND_TEXT because, even though the latter
+ − 37 ;; gives us more information when taking data from other XEmacs invocations,
+ − 38 ;; Mozilla will happily give us broken COMPOUND_TEXT where a non-broken
+ − 39 ;; UTF8_STRING is available.
+ − 40 (defvar selection-preferred-types
+ − 41 (let ((res '(UTF8_STRING COMPOUND_TEXT STRING image/png image/gif
+ − 42 image/jpeg image/tiff image/xpm image/xbm)))
+ − 43 (unless (featurep 'mule) (delq 'COMPOUND_TEXT res))
+ − 44 res)
+ − 45 "An ordered list of X11 type atoms for selections we want to receive.
+ − 46 We prefer UTF8_STRING over COMPOUND_TEXT, for compatibility with a certain
+ − 47 widely-used browser suite, and COMPOUND_TEXT over STRING. (COMPOUND_TEXT
+ − 48 isn't available on non-Mule.) We also accept several image types.
+ − 49
+ − 50 For compatibility, this can be a single atom. ")
+ − 51
+ − 52 ;; Renamed because it was just ridiculous for it to be mostly image formats
+ − 53 ;; and named selected-text-type.
+ − 54 (define-obsolete-variable-alias 'selected-text-type 'selection-preferred-types)
428
+ − 55
444
+ − 56 (defvar selection-sets-clipboard nil
428
+ − 57 "Controls the selection's relationship to the clipboard.
+ − 58 When non-nil, any operation that sets the primary selection will also
+ − 59 set the clipboard.")
+ − 60
+ − 61 (defun copy-primary-selection ()
851
+ − 62 "Copy the selection to the Clipboard and the kill ring.
+ − 63 This is similar to the command \\[kill-ring-save] except that it will
+ − 64 save to the Clipboard even if that command doesn't, and it handles rectangles
+ − 65 properly."
428
+ − 66 (interactive)
+ − 67 (and (console-on-window-system-p)
+ − 68 (cut-copy-clear-internal 'copy)))
+ − 69
+ − 70 (defun kill-primary-selection ()
2624
+ − 71 "Copy the selection to the Clipboard and the kill ring, then delete it.
851
+ − 72 This is similar to the command \\[kill-region] except that it will
+ − 73 save to the Clipboard even if that command doesn't, and it handles rectangles
+ − 74 properly."
428
+ − 75 (interactive "*")
+ − 76 (and (console-on-window-system-p)
+ − 77 (cut-copy-clear-internal 'cut)))
+ − 78
+ − 79 (defun delete-primary-selection ()
+ − 80 "Delete the selection without copying it to the Clipboard or the kill ring."
+ − 81 (interactive "*")
+ − 82 (and (console-on-window-system-p)
+ − 83 (cut-copy-clear-internal 'clear)))
+ − 84
+ − 85 (defun yank-clipboard-selection ()
+ − 86 "Insert the current Clipboard selection at point."
+ − 87 (interactive "*")
+ − 88 (when (console-on-window-system-p)
+ − 89 (setq last-command nil)
+ − 90 (setq this-command 'yank) ; so that yank-pop works.
+ − 91 (let ((clip (get-clipboard)))
+ − 92 (or clip (error "there is no clipboard selection"))
+ − 93 (push-mark)
+ − 94 (insert clip))))
+ − 95
+ − 96 (defun get-clipboard ()
829
+ − 97 "Return text pasted to the clipboard.
843
+ − 98 Not suitable for `interprogram-paste-function', use `get-clipboard-foreign'."
+ − 99 (get-selection 'CLIPBOARD))
+ − 100
+ − 101 (defun get-clipboard-foreign ()
+ − 102 "Return text pasted to the clipboard by another program.
829
+ − 103 See `interprogram-paste-function' for more information."
843
+ − 104 (get-selection-foreign 'CLIPBOARD))
428
+ − 105
+ − 106 (define-device-method get-cutbuffer
+ − 107 "Return the value of one of the cut buffers.
+ − 108 This will do nothing under anything other than X.")
+ − 109
+ − 110 (defun get-selection-no-error (&optional type data-type)
442
+ − 111 "Return the value of a window-system selection.
2624
+ − 112 The argument TYPE (default `PRIMARY') says which selection, and the argument
+ − 113 DATA-TYPE (defaulting to the value of `selection-preferred-types'), says how
+ − 114 to convert the data. Returns NIL if there is no selection."
442
+ − 115 (condition-case nil (get-selection type data-type) (t nil)))
428
+ − 116
+ − 117 (defun get-selection (&optional type data-type)
843
+ − 118 "Return the value of a window-system selection.
2624
+ − 119 The argument TYPE (default `PRIMARY') says which selection, and the argument
+ − 120 DATA-TYPE (defaulting to the value of, and compatible with,
+ − 121 `selection-preferred-types') says how to convert the data. If
+ − 122 there is no selection an error is signalled. Not suitable in a
+ − 123 `interprogram-paste-function', q.v."
428
+ − 124 (or type (setq type 'PRIMARY))
2624
+ − 125 (or data-type (setq data-type selection-preferred-types))
829
+ − 126 (if (consp data-type)
2624
+ − 127 ;; TARGETS is a vector; we want a list so we can memq --> append it to
+ − 128 ;; nil.
+ − 129 (let ((targets (append (get-selection-internal type 'TARGETS) nil))
+ − 130 res)
+ − 131 (catch 'converted
+ − 132 (if targets
+ − 133 (dolist (current-preference data-type)
3072
+ − 134 (condition-case nil
2624
+ − 135 (if (and (memq current-preference targets)
+ − 136 (setq res (get-selection-internal
+ − 137 type current-preference)))
+ − 138 (throw 'converted res))
+ − 139 (selection-conversion-error
+ − 140 nil))))
+ − 141 ;; The source app didn't offer us anything compatible in TARGETS,
+ − 142 ;; or they're not negotiating at all. (That is, we're probably not
+ − 143 ;; on X11.) Try to convert to the types specified by our caller,
+ − 144 ;; and throw an error if the last one of those fails.
+ − 145 (while data-type
+ − 146 (condition-case err
+ − 147 (progn
+ − 148 (setq res (get-selection-internal type (car data-type)))
2656
+ − 149 (if res (throw 'converted res)
+ − 150 (signal 'selection-conversion-error nil)))
2624
+ − 151 (selection-conversion-error
+ − 152 (if (cdr data-type)
2656
+ − 153 (setq data-type (cdr data-type))
2624
+ − 154 (signal (car err) (cdr err))))))))
829
+ − 155 (get-selection-internal type data-type)))
428
+ − 156
847
+ − 157 (defun get-selection-foreign (&optional type data-type)
+ − 158 "Return the value of a window-system selection, or nil if XEmacs owns it.
2624
+ − 159 The argument TYPE (default `PRIMARY') says which selection, and the argument
+ − 160 DATA-TYPE (defaulting to the value of `selection-preferred-types' which see)
+ − 161 says how to convert the data. If there is no selection an error is
+ − 162 signalled. See `interprogram-paste-function' for more information."
847
+ − 163 (unless (selection-owner-p type)
+ − 164 (get-selection type data-type)))
+ − 165
428
+ − 166 ;; FSFmacs calls this `x-set-selection', and reverses the
442
+ − 167 ;; first two arguments (duh ...). This order is more logical.
+ − 168 (defun own-selection (data &optional type how-to-add data-type)
+ − 169 "Make a window-system selection of type TYPE and value DATA.
428
+ − 170 The argument TYPE (default `PRIMARY') says which selection,
442
+ − 171 and DATA specifies the contents. DATA may be any lisp data type
+ − 172 that can be converted using the function corresponding to DATA-TYPE
+ − 173 in `select-converter-alist'---strings are the usual choice, but
+ − 174 other types may be permissible depending on the DATA-TYPE parameter
851
+ − 175 \(if DATA-TYPE is not supplied, the default behavior is window
442
+ − 176 system specific, but strings are always accepted).
+ − 177 HOW-TO-ADD may be any of the following:
+ − 178
+ − 179 'replace-all or nil -- replace all data in the selection.
+ − 180 'replace-existing -- replace data for specified DATA-TYPE only.
+ − 181 'append or t -- append data to existing DATA-TYPE data.
+ − 182
+ − 183 DATA-TYPE is the window-system specific data type identifier
851
+ − 184 \(see `register-selection-data-type' for more information).
428
+ − 185
+ − 186 The selection may also be a cons of two markers pointing to the same buffer,
+ − 187 or an overlay. In these cases, the selection is considered to be the text
442
+ − 188 between the markers *at whatever time the selection is examined* (note
+ − 189 that the window system clipboard does not necessarily duplicate this
+ − 190 behavior - it doesn't on mswindows for example).
428
+ − 191 Thus, editing done in the buffer after you specify the selection
+ − 192 can alter the effective value of the selection.
+ − 193
+ − 194 The data may also be a vector of valid non-vector selection values.
+ − 195
+ − 196 Interactively, the text of the region is used as the selection value."
+ − 197 (interactive (if (not current-prefix-arg)
+ − 198 (list (read-string "Store text for pasting: "))
+ − 199 (list (substring (region-beginning) (region-end)))))
442
+ − 200 ;; calling own-selection-internal will mess this up, so preserve it.
+ − 201 (let ((zmacs-region-stays zmacs-region-stays))
+ − 202 ;FSFmacs huh?? It says:
+ − 203 ;; "This is for temporary compatibility with pre-release Emacs 19."
+ − 204 ;(if (stringp type)
+ − 205 ; (setq type (intern type)))
+ − 206 (or type (setq type 'PRIMARY))
+ − 207 (if (null data)
+ − 208 (disown-selection-internal type)
+ − 209 (own-selection-internal type data how-to-add data-type)
+ − 210 (when (and (eq type 'PRIMARY)
+ − 211 selection-sets-clipboard)
+ − 212 (own-selection-internal 'CLIPBOARD data how-to-add data-type)))
+ − 213 (cond ((eq type 'PRIMARY)
+ − 214 (setq primary-selection-extent
+ − 215 (select-make-extent-for-selection
+ − 216 data primary-selection-extent)))
+ − 217 ((eq type 'SECONDARY)
+ − 218 (setq secondary-selection-extent
+ − 219 (select-make-extent-for-selection
+ − 220 data secondary-selection-extent)))))
+ − 221 ;; zmacs-region-stays is for commands, not low-level functions.
+ − 222 ;; when behaving as the latter, we better not set it, or we will
+ − 223 ;; cause unwanted sticky-region behavior in kill-region and friends.
+ − 224 (if (interactive-p)
+ − 225 (setq zmacs-region-stays t))
428
+ − 226 data)
+ − 227
+ − 228 (defun dehilight-selection (selection)
+ − 229 "for use as a value of `lost-selection-hooks'."
+ − 230 (cond ((eq selection 'PRIMARY)
+ − 231 (if primary-selection-extent
+ − 232 (let ((inhibit-quit t))
+ − 233 (if (consp primary-selection-extent)
+ − 234 (mapcar 'delete-extent primary-selection-extent)
+ − 235 (delete-extent primary-selection-extent))
+ − 236 (setq primary-selection-extent nil)))
+ − 237 (if zmacs-regions (zmacs-deactivate-region)))
+ − 238 ((eq selection 'SECONDARY)
+ − 239 (if secondary-selection-extent
+ − 240 (let ((inhibit-quit t))
+ − 241 (if (consp secondary-selection-extent)
+ − 242 (mapcar 'delete-extent secondary-selection-extent)
+ − 243 (delete-extent secondary-selection-extent))
+ − 244 (setq secondary-selection-extent nil)))))
+ − 245 nil)
+ − 246
+ − 247 (setq lost-selection-hooks 'dehilight-selection)
+ − 248
442
+ − 249 (defun own-clipboard (string &optional push)
+ − 250 "Paste the given string to the window system Clipboard.
+ − 251 See `interprogram-cut-function' for more information."
428
+ − 252 (own-selection string 'CLIPBOARD))
+ − 253
+ − 254 (defun disown-selection (&optional secondary-p)
487
+ − 255 "Assuming we own the selection, disown it.
+ − 256 With an argument, discard the secondary selection instead of the
+ − 257 primary selection."
428
+ − 258 (disown-selection-internal (if secondary-p 'SECONDARY 'PRIMARY))
+ − 259 (when (and selection-sets-clipboard
+ − 260 (or (not secondary-p)
+ − 261 (eq secondary-p 'PRIMARY)
+ − 262 (eq secondary-p 'CLIPBOARD)))
+ − 263 (disown-selection-internal 'CLIPBOARD)))
+ − 264
+ − 265 ;; selections and active regions
+ − 266
+ − 267 ;; If and only if zmacs-regions is true:
+ − 268
+ − 269 ;; When a mark is pushed and the region goes into the "active" state, we
+ − 270 ;; assert it as the Primary selection. This causes it to be hilighted.
+ − 271 ;; When the region goes into the "inactive" state, we disown the Primary
+ − 272 ;; selection, causing the region to be dehilighted.
+ − 273
+ − 274 ;; Note that it is possible for the region to be in the "active" state
+ − 275 ;; and not be hilighted, if it is in the active state and then some other
+ − 276 ;; application asserts the selection. This is probably not a big deal.
+ − 277
+ − 278 (defun activate-region-as-selection ()
4222
+ − 279 (cond ((and-fboundp #'mouse-track-rectangle-p
+ − 280 (mouse-track-rectangle-p
+ − 281 (mouse-track-activate-rectangular-selection))))
487
+ − 282 ((marker-buffer (mark-marker t))
+ − 283 (own-selection (cons (point-marker t) (mark-marker t))))))
428
+ − 284
+ − 285 (defvar primary-selection-extent nil
+ − 286 "The extent of the primary selection; don't use this.")
+ − 287
+ − 288 (defvar secondary-selection-extent nil
+ − 289 "The extent of the secondary selection; don't use this.")
+ − 290
+ − 291 (defun select-make-extent-for-selection (selection previous-extent)
+ − 292 ;; Given a selection, this makes an extent in the buffer which holds that
+ − 293 ;; selection, for highlighting purposes. If the selection isn't associated
+ − 294 ;; with a buffer, this does nothing.
2624
+ − 295 ;;
+ − 296 ;; Something similar needs to be hooked into the rectangle functions.
428
+ − 297 (let ((buffer nil)
+ − 298 (valid (and (extentp previous-extent)
+ − 299 (extent-object previous-extent)
+ − 300 (buffer-live-p (extent-object previous-extent))))
+ − 301 start end)
+ − 302 (cond ((stringp selection)
+ − 303 ;; if we're selecting a string, lose the previous extent used
+ − 304 ;; to highlight the selection.
+ − 305 (setq valid nil))
+ − 306 ((consp selection)
+ − 307 (setq start (min (car selection) (cdr selection))
+ − 308 end (max (car selection) (cdr selection))
+ − 309 valid (and valid
+ − 310 (eq (marker-buffer (car selection))
+ − 311 (extent-object previous-extent)))
+ − 312 buffer (marker-buffer (car selection))))
+ − 313 ((extentp selection)
+ − 314 (setq start (extent-start-position selection)
+ − 315 end (extent-end-position selection)
+ − 316 valid (and valid
+ − 317 (eq (extent-object selection)
+ − 318 (extent-object previous-extent)))
+ − 319 buffer (extent-object selection)))
+ − 320 (t
+ − 321 (signal 'error (list "invalid selection" selection))))
+ − 322
+ − 323 (if valid
+ − 324 nil
+ − 325 (condition-case ()
+ − 326 (if (listp previous-extent)
+ − 327 (mapcar 'delete-extent previous-extent)
+ − 328 (delete-extent previous-extent))
+ − 329 (error nil)))
+ − 330
+ − 331 (if (not buffer)
+ − 332 ;; string case
+ − 333 nil
+ − 334 ;; normal case
+ − 335 (if valid
+ − 336 (set-extent-endpoints previous-extent start end)
+ − 337 (setq previous-extent (make-extent start end buffer))
+ − 338
+ − 339 ;; Make the extent be closed on the right, which means that if
+ − 340 ;; characters are inserted exactly at the end of the extent, the
+ − 341 ;; extent will grow to cover them. This is important for shell
+ − 342 ;; buffers - suppose one makes a selection, and one end is at
+ − 343 ;; point-max. If the shell produces output, that marker will remain
+ − 344 ;; at point-max (its position will increase). So it's important that
+ − 345 ;; the extent exhibit the same behavior, lest the region covered by
+ − 346 ;; the extent (the visual indication), and the region between point
+ − 347 ;; and mark (the actual selection value) become different!
+ − 348 (set-extent-property previous-extent 'end-open nil)
+ − 349
+ − 350 (cond
4222
+ − 351 ((and-fboundp #'mouse-track-rectangle-p
+ − 352 (mouse-track-rectangle-p
+ − 353 (setq previous-extent (list previous-extent))
+ − 354 (default-mouse-track-next-move-rect start end previous-extent)
+ − 355 ))))
428
+ − 356 previous-extent))))
+ − 357
+ − 358 (defun valid-simple-selection-p (data)
442
+ − 359 "An obsolete function that tests whether something was a valid simple
+ − 360 selection using the old XEmacs selection support. You shouldn't use this
+ − 361 any more, because just about anything could be a valid selection now."
428
+ − 362 (or (stringp data)
+ − 363 ;FSFmacs huh?? (symbolp data)
+ − 364 (integerp data)
+ − 365 (and (consp data)
+ − 366 (integerp (car data))
+ − 367 (or (integerp (cdr data))
+ − 368 (and (consp (cdr data))
+ − 369 (integerp (car (cdr data))))))
+ − 370 (extentp data)
+ − 371 (and (consp data)
+ − 372 (markerp (car data))
+ − 373 (markerp (cdr data))
+ − 374 (marker-buffer (car data))
+ − 375 (marker-buffer (cdr data))
+ − 376 (eq (marker-buffer (car data))
+ − 377 (marker-buffer (cdr data)))
+ − 378 (buffer-live-p (marker-buffer (car data)))
+ − 379 (buffer-live-p (marker-buffer (cdr data))))))
+ − 380
+ − 381 (defun cut-copy-clear-internal (mode)
+ − 382 (or (memq mode '(cut copy clear)) (error "unkown mode %S" mode))
+ − 383 (or (selection-owner-p)
+ − 384 (error "XEmacs does not own the primary selection"))
+ − 385 (setq last-command nil)
+ − 386 (or primary-selection-extent
+ − 387 (error "the primary selection is not an extent?"))
+ − 388 (save-excursion
+ − 389 (let (rect-p b s e)
+ − 390 (cond
+ − 391 ((consp primary-selection-extent)
+ − 392 (setq rect-p t
+ − 393 b (extent-object (car primary-selection-extent))
+ − 394 s (extent-start-position (car primary-selection-extent))
+ − 395 e (extent-end-position (car (reverse primary-selection-extent)))))
+ − 396 (t
+ − 397 (setq rect-p nil
+ − 398 b (extent-object primary-selection-extent)
+ − 399 s (extent-start-position primary-selection-extent)
+ − 400 e (extent-end-position primary-selection-extent))))
+ − 401 (set-buffer b)
+ − 402 (cond ((memq mode '(cut copy))
+ − 403 (if rect-p
+ − 404 (progn
851
+ − 405 ;; killed-rectangle is defvarred in rect.el
428
+ − 406 (setq killed-rectangle (extract-rectangle s e))
+ − 407 (kill-new (mapconcat #'identity killed-rectangle "\n")))
+ − 408 (copy-region-as-kill s e))
+ − 409 ;; Maybe killing doesn't own clipboard. Make sure it happens.
+ − 410 ;; This memq is kind of grody, because they might have done it
+ − 411 ;; some other way, but owning the clipboard twice in that case
+ − 412 ;; wouldn't actually hurt anything.
+ − 413 (or (and (consp kill-hooks) (memq 'own-clipboard kill-hooks))
851
+ − 414 (eq 'own-clipboard interprogram-cut-function)
428
+ − 415 (own-clipboard (car kill-ring)))))
+ − 416 (cond ((memq mode '(cut clear))
+ − 417 (if rect-p
+ − 418 (delete-rectangle s e)
+ − 419 (delete-region s e))))
+ − 420 (disown-selection nil)
+ − 421 )))
+ − 422
442
+ − 423
428
+ − 424 ;;; Functions to convert the selection into various other selection
442
+ − 425 ;;; types.
+ − 426
+ − 427 ;; These next three functions get called by C code...
+ − 428 (defun select-convert-in (selection type value)
+ − 429 "Attempt to convert the specified external VALUE to the specified DATA-TYPE,
+ − 430 for the specified SELECTION. Return nil if this is impossible, or a
+ − 431 suitable internal representation otherwise."
+ − 432 (when value
+ − 433 (let ((handler-fn (cdr (assq type selection-converter-in-alist))))
2624
+ − 434 (if handler-fn
+ − 435 (apply handler-fn (list selection type value))
+ − 436 value))))
428
+ − 437
442
+ − 438 (defun select-convert-out (selection type value)
+ − 439 "Attempt to convert the specified internal VALUE for the specified DATA-TYPE
+ − 440 and SELECTION. Return nil if this is impossible, or a suitable external
+ − 441 representation otherwise."
+ − 442 (when value
+ − 443 (let ((handler-fn (cdr (assq type selection-converter-out-alist))))
+ − 444 (when handler-fn
+ − 445 (apply handler-fn (list selection type value))))))
+ − 446
+ − 447 (defun select-coerce (selection type value)
+ − 448 "Attempt to convert the specified internal VALUE to a representation
+ − 449 suitable for return from `get-selection' in the specified DATA-TYPE. Return
+ − 450 nil if this is impossible, or a suitable representation otherwise."
+ − 451 (when value
+ − 452 (let ((handler-fn (cdr (assq type selection-coercion-alist))))
+ − 453 (when handler-fn
+ − 454 (apply handler-fn (list selection type value))))))
+ − 455
+ − 456 ;; The rest of the functions on this "page" are conversion handlers,
+ − 457 ;; append handlers and buffer-kill handlers.
428
+ − 458 (defun select-convert-to-text (selection type value)
+ − 459 (cond ((stringp value)
+ − 460 value)
+ − 461 ((extentp value)
+ − 462 (save-excursion
+ − 463 (set-buffer (extent-object value))
+ − 464 (save-restriction
+ − 465 (widen)
+ − 466 (buffer-substring (extent-start-position value)
+ − 467 (extent-end-position value)))))
+ − 468 ((and (consp value)
+ − 469 (markerp (car value))
+ − 470 (markerp (cdr value)))
+ − 471 (or (eq (marker-buffer (car value)) (marker-buffer (cdr value)))
+ − 472 (signal 'error
+ − 473 (list "markers must be in the same buffer"
+ − 474 (car value) (cdr value))))
+ − 475 (save-excursion
+ − 476 (set-buffer (or (marker-buffer (car value))
+ − 477 (error "selection is in a killed buffer")))
+ − 478 (save-restriction
+ − 479 (widen)
+ − 480 (buffer-substring (car value) (cdr value)))))
+ − 481 (t nil)))
+ − 482
2624
+ − 483 (defun select-convert-to-timestamp (selection type value)
+ − 484 (let ((ts (get-xemacs-selection-timestamp selection)))
+ − 485 (if ts (cons 'TIMESTAMP ts))))
+ − 486
+ − 487 (defun select-convert-to-utf-8-text (selection type value)
+ − 488 (cond ((stringp value)
+ − 489 (cons 'UTF8_STRING (encode-coding-string value 'utf-8)))
+ − 490 ((extentp value)
+ − 491 (save-excursion
+ − 492 (set-buffer (extent-object value))
+ − 493 (save-restriction
+ − 494 (widen)
+ − 495 (cons 'UTF8_STRING
+ − 496 (encode-coding-string
+ − 497 (buffer-substring (extent-start-position value)
+ − 498 (extent-end-position value)) 'utf-8)))))
+ − 499 ((and (consp value)
+ − 500 (markerp (car value))
+ − 501 (markerp (cdr value)))
+ − 502 (or (eq (marker-buffer (car value)) (marker-buffer (cdr value)))
+ − 503 (signal 'error
+ − 504 (list "markers must be in the same buffer"
+ − 505 (car value) (cdr value))))
+ − 506 (save-excursion
+ − 507 (set-buffer (or (marker-buffer (car value))
+ − 508 (error "selection is in a killed buffer")))
+ − 509 (save-restriction
+ − 510 (widen)
+ − 511 (cons 'UTF8_STRING (encode-coding-string
+ − 512 (buffer-substring (car value) (cdr value))
+ − 513 'utf-8)))))
+ − 514 (t nil)))
+ − 515
442
+ − 516 (defun select-coerce-to-text (selection type value)
+ − 517 (select-convert-to-text selection type value))
+ − 518
428
+ − 519 (defun select-convert-to-string (selection type value)
+ − 520 (let ((outval (select-convert-to-text selection type value)))
442
+ − 521 ;; force the string to be not in Compound Text format. This grubby
+ − 522 ;; hack will go soon, to be replaced by a more general mechanism.
428
+ − 523 (if (stringp outval)
+ − 524 (cons 'STRING outval)
+ − 525 outval)))
+ − 526
+ − 527 (defun select-convert-to-compound-text (selection type value)
+ − 528 ;; converts to compound text automatically
+ − 529 (select-convert-to-text selection type value))
+ − 530
+ − 531 (defun select-convert-to-length (selection type value)
+ − 532 (let ((value
+ − 533 (cond ((stringp value)
+ − 534 (length value))
+ − 535 ((extentp value)
+ − 536 (extent-length value))
+ − 537 ((and (consp value)
+ − 538 (markerp (car value))
+ − 539 (markerp (cdr value)))
+ − 540 (or (eq (marker-buffer (car value))
+ − 541 (marker-buffer (cdr value)))
+ − 542 (signal 'error
+ − 543 (list "markers must be in the same buffer"
+ − 544 (car value) (cdr value))))
+ − 545 (abs (- (car value) (cdr value)))))))
+ − 546 (if value ; force it to be in 32-bit format.
+ − 547 (cons (ash value -16) (logand value 65535))
+ − 548 nil)))
+ − 549
+ − 550 (defun select-convert-to-targets (selection type value)
+ − 551 ;; return a vector of atoms, but remove duplicates first.
+ − 552 (let* ((all (cons 'TIMESTAMP (mapcar 'car selection-converter-alist)))
+ − 553 (rest all))
+ − 554 (while rest
+ − 555 (cond ((memq (car rest) (cdr rest))
+ − 556 (setcdr rest (delq (car rest) (cdr rest))))
+ − 557 (t
+ − 558 (setq rest (cdr rest)))))
+ − 559 (apply 'vector all)))
+ − 560
+ − 561 (defun select-convert-to-delete (selection type value)
+ − 562 (disown-selection-internal selection)
+ − 563 ;; A return value of nil means that we do not know how to do this conversion,
+ − 564 ;; and replies with an "error". A return value of NULL means that we have
+ − 565 ;; done the conversion (and any side-effects) but have no value to return.
+ − 566 'NULL)
+ − 567
+ − 568 (defun select-convert-to-filename (selection type value)
+ − 569 (cond ((extentp value)
+ − 570 (buffer-file-name (or (extent-object value)
+ − 571 (error "selection is in a killed buffer"))))
+ − 572 ((and (consp value)
+ − 573 (markerp (car value))
+ − 574 (markerp (cdr value)))
+ − 575 (buffer-file-name (or (marker-buffer (car value))
+ − 576 (error "selection is in a killed buffer"))))
+ − 577 (t nil)))
+ − 578
+ − 579 (defun select-convert-to-charpos (selection type value)
+ − 580 (let (a b tmp)
+ − 581 (cond ((cond ((extentp value)
+ − 582 (setq a (extent-start-position value)
+ − 583 b (extent-end-position value)))
+ − 584 ((and (consp value)
+ − 585 (markerp (car value))
+ − 586 (markerp (cdr value)))
+ − 587 (setq a (car value)
+ − 588 b (cdr value))))
+ − 589 (setq a (1- a) b (1- b)) ; zero-based
+ − 590 (if (< b a) (setq tmp a a b b tmp))
+ − 591 (cons 'SPAN
+ − 592 (vector (cons (ash a -16) (logand a 65535))
+ − 593 (cons (ash b -16) (logand b 65535))))))))
+ − 594
+ − 595 (defun select-convert-to-lineno (selection type value)
+ − 596 (let (a b buf tmp)
+ − 597 (cond ((cond ((extentp value)
+ − 598 (setq buf (extent-object value)
+ − 599 a (extent-start-position value)
+ − 600 b (extent-end-position value)))
+ − 601 ((and (consp value)
+ − 602 (markerp (car value))
+ − 603 (markerp (cdr value)))
+ − 604 (setq a (marker-position (car value))
+ − 605 b (marker-position (cdr value))
+ − 606 buf (marker-buffer (car value)))))
+ − 607 (save-excursion
+ − 608 (set-buffer buf)
+ − 609 (save-restriction
+ − 610 (widen)
+ − 611 (goto-char a)
+ − 612 (beginning-of-line)
+ − 613 (setq a (1+ (count-lines 1 (point))))
+ − 614 (goto-char b)
+ − 615 (beginning-of-line)
+ − 616 (setq b (1+ (count-lines 1 (point))))))
+ − 617 (if (< b a) (setq tmp a a b b tmp))
+ − 618 (cons 'SPAN
+ − 619 (vector (cons (ash a -16) (logand a 65535))
+ − 620 (cons (ash b -16) (logand b 65535))))))))
+ − 621
+ − 622 (defun select-convert-to-colno (selection type value)
+ − 623 (let (a b buf tmp)
+ − 624 (cond ((cond ((extentp value)
+ − 625 (setq buf (extent-object value)
+ − 626 a (extent-start-position value)
+ − 627 b (extent-end-position value)))
+ − 628 ((and (consp value)
+ − 629 (markerp (car value))
+ − 630 (markerp (cdr value)))
+ − 631 (setq a (car value)
+ − 632 b (cdr value)
+ − 633 buf (marker-buffer a))))
+ − 634 (save-excursion
+ − 635 (set-buffer buf)
+ − 636 (goto-char a)
+ − 637 (setq a (current-column))
+ − 638 (goto-char b)
+ − 639 (setq b (current-column)))
+ − 640 (if (< b a) (setq tmp a a b b tmp))
+ − 641 (cons 'SPAN
+ − 642 (vector (cons (ash a -16) (logand a 65535))
+ − 643 (cons (ash b -16) (logand b 65535))))))))
+ − 644
+ − 645 (defun select-convert-to-sourceloc (selection type value)
+ − 646 (let (a b buf file-name tmp)
+ − 647 (cond ((cond ((extentp value)
+ − 648 (setq buf (or (extent-object value)
+ − 649 (error "selection is in a killed buffer"))
+ − 650 a (extent-start-position value)
+ − 651 b (extent-end-position value)
+ − 652 file-name (buffer-file-name buf)))
+ − 653 ((and (consp value)
+ − 654 (markerp (car value))
+ − 655 (markerp (cdr value)))
+ − 656 (setq a (marker-position (car value))
+ − 657 b (marker-position (cdr value))
+ − 658 buf (or (marker-buffer (car value))
+ − 659 (error "selection is in a killed buffer"))
+ − 660 file-name (buffer-file-name buf))))
+ − 661 (save-excursion
+ − 662 (set-buffer buf)
+ − 663 (save-restriction
+ − 664 (widen)
+ − 665 (goto-char a)
+ − 666 (beginning-of-line)
+ − 667 (setq a (1+ (count-lines 1 (point))))
+ − 668 (goto-char b)
+ − 669 (beginning-of-line)
+ − 670 (setq b (1+ (count-lines 1 (point))))))
+ − 671 (if (< b a) (setq tmp a a b b tmp))
+ − 672 (format "%s:%d" file-name a)))))
+ − 673
+ − 674 (defun select-convert-to-os (selection type size)
+ − 675 (symbol-name system-type))
+ − 676
+ − 677 (defun select-convert-to-host (selection type size)
+ − 678 (system-name))
+ − 679
+ − 680 (defun select-convert-to-user (selection type size)
+ − 681 (user-full-name))
+ − 682
+ − 683 (defun select-convert-to-class (selection type size)
442
+ − 684 (symbol-value 'x-emacs-application-class))
428
+ − 685
+ − 686 ;; We do not try to determine the name Emacs was invoked with,
+ − 687 ;; because it is not clean for a program's behavior to depend on that.
+ − 688 (defun select-convert-to-name (selection type size)
+ − 689 ;invocation-name
+ − 690 "xemacs")
+ − 691
+ − 692 (defun select-convert-to-integer (selection type value)
+ − 693 (and (integerp value)
+ − 694 (cons (ash value -16) (logand value 65535))))
+ − 695
442
+ − 696 ;; Can convert from the following integer representations
+ − 697 ;;
+ − 698 ;; integer
+ − 699 ;; (integer . integer)
+ − 700 ;; (integer integer)
+ − 701 ;; (list [integer|(integer . integer)]*)
+ − 702 ;; (vector [integer|(integer . integer)]*)
+ − 703 ;;
+ − 704 ;; Cons'd integers get cleaned up a little.
+ − 705
+ − 706 (defun select-convert-from-integer (selection type value)
+ − 707 (cond ((integerp value) ; Integer
+ − 708 value)
444
+ − 709
442
+ − 710 ((and (consp value) ; (integer . integer)
+ − 711 (integerp (car value))
+ − 712 (integerp (cdr value)))
+ − 713 (if (eq (car value) 0)
+ − 714 (cdr value)
+ − 715 (if (and (eq (car value) -1)
+ − 716 (< (cdr value) 0))
+ − 717 (cdr value)
+ − 718 value)))
444
+ − 719
442
+ − 720 ((and (listp value) ; (integer integer)
+ − 721 (eq (length value) 2)
+ − 722 (integerp (car value))
+ − 723 (integerp (cadr value)))
+ − 724 (if (eq (car value) 0)
+ − 725 (cadr value)
+ − 726 (if (and (eq (car value) -1)
+ − 727 (< (cdr value) 0))
+ − 728 (- (cadr value))
+ − 729 (cons (car value) (cadr value)))))
444
+ − 730
442
+ − 731 ((listp value) ; list
+ − 732 (if (cdr value)
4021
+ − 733 (mapcar #'(lambda (x)
+ − 734 (select-convert-from-integer selection type x))
442
+ − 735 value)
+ − 736 (select-convert-from-integer selection type (car value))))
444
+ − 737
442
+ − 738 ((vectorp value) ; vector
+ − 739 (if (eq (length value) 1)
+ − 740 (select-convert-from-integer selection type (aref value 0))
4021
+ − 741 (mapvector #'(lambda (x)
+ − 742 (select-convert-from-integer selection type x))
+ − 743 value)))
444
+ − 744
442
+ − 745 (t nil)
+ − 746 ))
+ − 747
2624
+ − 748 (defun select-convert-from-ip-address (selection type value)
+ − 749 (if (and (stringp value)
+ − 750 (= (length value) 4))
+ − 751 (format "%d.%d.%d.%d"
+ − 752 (aref value 0) (aref value 1) (aref value 2) (aref value 3))))
+ − 753
428
+ − 754 (defun select-convert-to-atom (selection type value)
+ − 755 (and (symbolp value) value))
+ − 756
2624
+ − 757 (defun select-convert-from-utf-8-text (selection type value)
+ − 758 (decode-coding-string value 'utf-8))
+ − 759
+ − 760 (defun select-convert-from-utf-16-le-text (selection type value)
+ − 761 (decode-coding-string value 'utf-16-le))
+ − 762
+ − 763 ;; Image conversion.
+ − 764 (defun select-convert-from-image-data (image-type value)
+ − 765 "Take an image type specification--one of the image types this XEmacs
+ − 766 supports--and some data in that format, return a space, with a glyph
+ − 767 corresponding to that data as an end-glyph extent property of that space. "
+ − 768 (let* ((str (make-string 1 ?\ ))
+ − 769 (extent (make-extent 0 1 str))
+ − 770 (glyph (make-glyph (vector image-type ':data value))))
+ − 771 (when glyph
+ − 772 (set-extent-property extent 'invisible t)
+ − 773 (set-extent-property extent 'start-open t)
+ − 774 (set-extent-property extent 'end-open t)
+ − 775 (set-extent-property extent 'duplicable t)
+ − 776 (set-extent-property extent 'atomic t)
+ − 777 (set-extent-end-glyph extent glyph)
+ − 778 str)))
+ − 779
+ − 780 ;; Could automate defining these functions these with a macro, but damned if
+ − 781 ;; I can get that to work. Anyway, this is more readable.
+ − 782
+ − 783 (defun select-convert-from-image/gif (selection type value)
+ − 784 (if (featurep 'gif) (select-convert-from-image-data 'gif value)))
+ − 785
+ − 786 (defun select-convert-from-image/jpeg (selection type value)
+ − 787 (if (featurep 'jpeg) (select-convert-from-image-data 'jpeg value)))
+ − 788
+ − 789 (defun select-convert-from-image/png (selection type value)
+ − 790 (if (featurep 'png) (select-convert-from-image-data 'png value)))
+ − 791
+ − 792 (defun select-convert-from-image/tiff (selection type value)
+ − 793 (if (featurep 'tiff) (select-convert-from-image-data 'tiff value)))
+ − 794
+ − 795 (defun select-convert-from-image/xpm (selection type value)
+ − 796 (if (featurep 'xpm) (select-convert-from-image-data 'xpm value)))
+ − 797
+ − 798 (defun select-convert-from-image/xbm (selection type value)
+ − 799 (if (featurep 'xbm) (select-convert-from-image-data 'xbm value)))
+ − 800
442
+ − 801 ;;; CF_xxx conversions
+ − 802 (defun select-convert-from-cf-text (selection type value)
2624
+ − 803 (if (find-coding-system 'mswindows-multibyte)
+ − 804 (let ((value (decode-coding-string value 'mswindows-multibyte)))
+ − 805 (replace-in-string (if (string-match "\0" value)
+ − 806 (substring value 0 (match-beginning 0))
+ − 807 value)
+ − 808 "\\(\r\n\\|\n\r\\)" "\n" t))))
771
+ − 809
+ − 810 (defun select-convert-from-cf-unicodetext (selection type value)
2624
+ − 811 (if (find-coding-system 'mswindows-unicode)
+ − 812 (let ((value (decode-coding-string value 'mswindows-unicode)))
+ − 813 (replace-in-string (if (string-match "\0" value)
+ − 814 (substring value 0 (match-beginning 0))
+ − 815 value)
+ − 816 "\\(\r\n\\|\n\r\\)" "\n" t))))
442
+ − 817
+ − 818 (defun select-convert-to-cf-text (selection type value)
2624
+ − 819 (if (find-coding-system 'mswindows-multibyte)
+ − 820 (let ((text (select-convert-to-text selection type value)))
+ − 821 (encode-coding-string
+ − 822 (concat (replace-in-string text "\n" "\r\n" t) "\0")
+ − 823 'mswindows-multibyte))))
771
+ − 824
+ − 825 (defun select-convert-to-cf-unicodetext (selection type value)
2624
+ − 826 (if (find-coding-system 'mswindows-unicode)
+ − 827 (let ((text (select-convert-to-text selection type value)))
+ − 828 (encode-coding-string
+ − 829 (concat (replace-in-string text "\n" "\r\n" t) "\0")
+ − 830 'mswindows-unicode))))
442
+ − 831
+ − 832 ;;; Appenders
+ − 833 (defun select-append-to-text (selection type value1 value2)
+ − 834 (let ((text1 (select-convert-to-text selection 'STRING value1))
+ − 835 (text2 (select-convert-to-text selection 'STRING value2)))
+ − 836 (if (and text1 text2)
+ − 837 (concat text1 text2)
+ − 838 nil)))
+ − 839
+ − 840 (defun select-append-to-string (selection type value1 value2)
+ − 841 (select-append-to-text selection type value1 value2))
+ − 842
+ − 843 (defun select-append-to-compound-text (selection type value1 value2)
+ − 844 (select-append-to-text selection type value1 value2))
+ − 845
+ − 846 (defun select-append-to-cf-text (selection type value1 value2)
+ − 847 (let ((text1 (select-convert-from-cf-text selection 'CF_TEXT value1))
+ − 848 (text2 (select-convert-from-cf-text selection 'CF_TEXT value2)))
+ − 849 (if (and text1 text2)
+ − 850 (select-convert-to-cf-text selection type (concat text1 text2))
+ − 851 nil)))
428
+ − 852
771
+ − 853 (defun select-append-to-cf-unicodetext (selection type value1 value2)
+ − 854 (let ((text1 (select-convert-from-cf-unicodetext selection
+ − 855 'CF_UNICODETEXT value1))
+ − 856 (text2 (select-convert-from-cf-unicodetext selection
+ − 857 'CF_UNICODETEXT value2)))
+ − 858 (if (and text1 text2)
+ − 859 (select-convert-to-cf-unicodetext selection type (concat text1 text2))
+ − 860 nil)))
+ − 861
442
+ − 862 (defun select-append-default (selection type value1 value2)
+ − 863 ;; This appender gets used if the type is "nil" - i.e. default.
+ − 864 ;; It should probably have more cases implemented than it does - e.g.
+ − 865 ;; appending numbers to strings, etc...
+ − 866 (cond ((and (stringp value1) (stringp value2))
+ − 867 (select-append-to-string selection 'STRING value1 value2))
+ − 868 (t nil)))
+ − 869
+ − 870 ;;; Buffer kill handlers
+ − 871
+ − 872 (defun select-buffer-killed-default (selection type value buffer)
+ − 873 ;; This handler gets used if the type is "nil".
+ − 874 (cond ((extentp value)
+ − 875 (if (eq (extent-object value) buffer)
+ − 876 ; If this selection is on the clipboard, grab it quick
+ − 877 (when (eq selection 'CLIPBOARD)
+ − 878 (save-excursion
+ − 879 (set-buffer (extent-object value))
+ − 880 (save-restriction
+ − 881 (widen)
+ − 882 (buffer-substring (extent-start-position value)
+ − 883 (extent-end-position value)))))
+ − 884 value))
+ − 885 ((markerp value)
+ − 886 (unless (eq (marker-buffer value) buffer)
+ − 887 value))
+ − 888 ((and (consp value)
+ − 889 (markerp (car value))
+ − 890 (markerp (cdr value)))
+ − 891 (if (or (eq (marker-buffer (car value)) buffer)
+ − 892 (eq (marker-buffer (cdr value)) buffer))
+ − 893 ; If this selection is on the clipboard, grab it quick
+ − 894 (when (eq selection 'CLIPBOARD)
+ − 895 (save-excursion
+ − 896 (set-buffer (marker-buffer (car value)))
+ − 897 (save-restriction
+ − 898 (widen)
+ − 899 (buffer-substring (car value) (cdr value)))))
+ − 900 value))
+ − 901 (t value)))
+ − 902
+ − 903 (defun select-buffer-killed-text (selection type value buffer)
+ − 904 (select-buffer-killed-default selection type value buffer))
444
+ − 905
442
+ − 906 ;; Types listed in here can be selections of XEmacs
+ − 907 (setq selection-converter-out-alist
2624
+ − 908 '((TIMESTAMP . select-convert-to-timestamp)
+ − 909 (UTF8_STRING . select-convert-to-utf-8-text)
+ − 910 (TEXT . select-convert-to-text)
428
+ − 911 (STRING . select-convert-to-string)
+ − 912 (COMPOUND_TEXT . select-convert-to-compound-text)
+ − 913 (TARGETS . select-convert-to-targets)
+ − 914 (LENGTH . select-convert-to-length)
+ − 915 (DELETE . select-convert-to-delete)
+ − 916 (FILE_NAME . select-convert-to-filename)
+ − 917 (CHARACTER_POSITION . select-convert-to-charpos)
+ − 918 (SOURCE_LOC . select-convert-to-sourceloc)
+ − 919 (LINE_NUMBER . select-convert-to-lineno)
+ − 920 (COLUMN_NUMBER . select-convert-to-colno)
+ − 921 (OWNER_OS . select-convert-to-os)
+ − 922 (HOST_NAME . select-convert-to-host)
+ − 923 (USER . select-convert-to-user)
+ − 924 (CLASS . select-convert-to-class)
+ − 925 (NAME . select-convert-to-name)
+ − 926 (ATOM . select-convert-to-atom)
+ − 927 (INTEGER . select-convert-to-integer)
442
+ − 928 (CF_TEXT . select-convert-to-cf-text)
771
+ − 929 (CF_UNICODETEXT . select-convert-to-cf-unicodetext)
442
+ − 930 ))
+ − 931
+ − 932 ;; Types listed here can be selections foreign to XEmacs
+ − 933 (setq selection-converter-in-alist
+ − 934 '(; Specific types that get handled by generic converters
+ − 935 (INTEGER . select-convert-from-integer)
2624
+ − 936 (TIMESTAMP . select-convert-from-integer)
+ − 937 (LENGTH . select-convert-from-integer)
+ − 938 (LIST_LENGTH . select-convert-from-integer)
+ − 939 (CLIENT_WINDOW . select-convert-from-integer)
+ − 940 (PROCESS . select-convert-from-integer)
+ − 941 (IP_ADDRESS . select-convert-from-ip-address)
+ − 942 ;; We go after UTF8_STRING in preference to STRING because Mozilla,
+ − 943 ;; at least, does bad things with non-Latin-1 Unicode characters in
+ − 944 ;; STRING.
+ − 945 (UTF8_STRING . select-convert-from-utf-8-text)
442
+ − 946 (CF_TEXT . select-convert-from-cf-text)
771
+ − 947 (CF_UNICODETEXT . select-convert-from-cf-unicodetext)
2624
+ − 948 (text/html . select-convert-from-utf-16-le-text) ; Mozilla
+ − 949 (text/_moz_htmlcontext . select-convert-from-utf-16-le-text)
+ − 950 (text/_moz_htmlinfo . select-convert-from-utf-16-le-text)
+ − 951 (image/png . select-convert-from-image/png)
+ − 952 (image/gif . select-convert-from-image/gif)
+ − 953 (image/jpeg . select-convert-from-image/jpeg )
+ − 954 (image/tiff . select-convert-from-image/tiff )
+ − 955 (image/xpm . select-convert-from-image/xpm)
+ − 956 (image/xbm . select-convert-from-image/xbm)
428
+ − 957 ))
+ − 958
442
+ − 959 ;; Types listed here have special coercion functions that can munge
+ − 960 ;; other types. This can also be used to add special features - e.g.
+ − 961 ;; being able to pass a region or a cons of markers to own-selection,
+ − 962 ;; but getting the *current* text in the region back when calling
+ − 963 ;; get-selection.
+ − 964 ;;
+ − 965 ;; Any function listed in here *will be called* whenever a value of
+ − 966 ;; its type is retrieved from the internal selection cache, or when
+ − 967 ;; no suitable values could be found in which case XEmacs looks for
+ − 968 ;; values with types listed in selection-coercible-types.
+ − 969 (setq selection-coercion-alist
+ − 970 '((TEXT . select-coerce-to-text)
+ − 971 (STRING . select-coerce-to-text)
+ − 972 (COMPOUND_TEXT . select-coerce-to-text)
771
+ − 973 (CF_TEXT . select-coerce-to-text)
+ − 974 (CF_UNICODETEXT . select-coerce-to-text)
+ − 975 ))
442
+ − 976
+ − 977 ;; Types listed here can be appended by own-selection
+ − 978 (setq selection-appender-alist
+ − 979 '((nil . select-append-default)
+ − 980 (TEXT . select-append-to-text)
+ − 981 (STRING . select-append-to-string)
+ − 982 (COMPOUND_TEXT . select-append-to-compound-text)
+ − 983 (CF_TEXT . select-append-to-cf-text)
771
+ − 984 (CF_UNICODETEXT . select-append-to-cf-unicodetext)
442
+ − 985 ))
+ − 986
+ − 987 ;; Types listed here have buffer-kill handlers
+ − 988 (setq selection-buffer-killed-alist
+ − 989 '((nil . select-buffer-killed-default)
+ − 990 (TEXT . select-buffer-killed-text)
+ − 991 (STRING . select-buffer-killed-text)
+ − 992 (COMPOUND_TEXT . select-buffer-killed-text)
771
+ − 993 (CF_TEXT . select-buffer-killed-text)
+ − 994 (CF_UNICODETEXT . select-buffer-killed-text)
+ − 995 ))
442
+ − 996
+ − 997 ;; Lists of types that are coercible (can be converted to other types)
771
+ − 998 (setq selection-coercible-types '(TEXT STRING COMPOUND_TEXT CF_TEXT CF_UNICODETEXT))
442
+ − 999
428
+ − 1000 ;;; select.el ends here