1 ;;; x-select.el --- Lisp interface to X Selections.
3 ;; Copyright (C) 1990, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995 Sun Microsystems.
6 ;; Maintainer: XEmacs Development Team
7 ;; Keywords: extensions, dumped
9 ;; This file is part of XEmacs.
11 ;; XEmacs is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; XEmacs is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with XEmacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
26 ;;; Synched up with: FSF 19.30 (select.el).
30 ;; This file is dumped with XEmacs (when X support is compiled in).
32 ;; The selection code requires us to use certain symbols whose names are
33 ;; all upper-case; this may seem tasteless, but it makes there be a 1:1
34 ;; correspondence between these symbols and X Atoms (which are upcased).
38 (define-obsolete-function-alias 'x-selection-exists-p 'selection-exists-p)
39 (define-obsolete-function-alias 'x-selection-owner-p 'selection-owner-p)
40 (define-obsolete-variable-alias 'x-selection-converter-alist 'selection-converter-alist)
41 (define-obsolete-variable-alias 'x-lost-selection-hooks 'lost-selection-hooks)
42 (define-obsolete-variable-alias 'x-selected-text-type 'selected-text-type)
43 (define-obsolete-function-alias 'x-valid-simple-selection-p 'valid-simple-selection-p)
44 (define-obsolete-function-alias 'x-own-selection 'own-selection)
45 (define-obsolete-function-alias 'x-disown-selection 'disown-selection)
46 (define-obsolete-function-alias 'x-delete-primary-selection 'delete-primary-selection)
47 (define-obsolete-function-alias 'x-copy-primary-selection 'copy-primary-selection)
48 (define-obsolete-function-alias 'x-kill-primary-selection 'kill-primary-selection)
49 (define-obsolete-function-alias 'x-select-make-extent-for-selection
50 'select-make-extent-for-selection)
51 (define-obsolete-function-alias 'x-cut-copy-clear-internal 'cut-copy-clear-internal)
52 (define-obsolete-function-alias 'x-get-selection 'get-selection)
53 (define-obsolete-function-alias 'x-get-clipboard 'get-clipboard)
54 (define-obsolete-function-alias 'x-yank-clipboard-selection
55 'yank-clipboard-selection)
56 (define-obsolete-function-alias 'x-disown-selection-internal
57 'disown-selection-internal)
59 (defun x-get-secondary-selection ()
60 "Return text selected from some X window."
61 (get-selection 'SECONDARY))
63 (defun x-own-secondary-selection (selection &optional type)
64 "Make a secondary X Selection of the given argument. The argument may be a
65 string or a cons of two markers (in which case the selection is considered to
66 be the text between those markers)."
67 (interactive (if (not current-prefix-arg)
68 (list (read-string "Store text for pasting: "))
69 (list (cons ;; these need not be ordered.
70 (copy-marker (point-marker))
71 (copy-marker (mark-marker))))))
72 (own-selection selection 'SECONDARY))
74 (defun x-notice-selection-requests (selection type successful)
75 "for possible use as the value of `x-sent-selection-hooks'."
77 (message "Selection request failed to convert %s to %s"
79 (message "Sent selection %s as %s" selection type)))
81 (defun x-notice-selection-failures (selection type successful)
82 "for possible use as the value of `x-sent-selection-hooks'."
84 (message "Selection request failed to convert %s to %s"
87 ;(setq x-sent-selection-hooks 'x-notice-selection-requests)
88 ;(setq x-sent-selection-hooks 'x-notice-selection-failures)
91 ;;; Cut Buffer support
93 ;;; FSF name x-get-cut-buffer
94 (defun x-get-cutbuffer (&optional which-one)
95 "Return the value of one of the 8 X server cut buffers.
96 Optional arg WHICH-ONE should be a number from 0 to 7, defaulting to 0.
97 Cut buffers are considered obsolete; you should use selections instead.
98 This function does nothing if cut buffer support was not compiled in."
99 (when (fboundp 'x-get-cutbuffer-internal)
100 (x-get-cutbuffer-internal
101 (aref [CUT_BUFFER0 CUT_BUFFER1 CUT_BUFFER2 CUT_BUFFER3
102 CUT_BUFFER4 CUT_BUFFER5 CUT_BUFFER6 CUT_BUFFER7]
105 ;;; FSF name x-set-cut-buffer
106 (defun x-store-cutbuffer (string &optional push)
107 "Store STRING into the X server's primary cut buffer.
108 If optional arg PUSH is non-nil, also rotate the cut buffers: this
109 means the previous value of the primary cut buffer moves to the second
110 cut buffer, and the second to the third, and so on (there are 8 buffers.)
111 Cut buffers are considered obsolete; you should use selections instead.
112 This function does nothing if cut buffer support was not compiled in."
113 (when (fboundp 'x-store-cutbuffer-internal)
115 (x-rotate-cutbuffers-internal 1))
116 (x-store-cutbuffer-internal 'CUT_BUFFER0 string)))
119 ;FSFmacs (provide 'select)
121 ;;; x-select.el ends here.