comparison lisp/x-select.el @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents 41ff10fd062f
children 7df0dd720c89
comparison
equal deleted inserted replaced
271:c7b7086b0a39 272:c5d627a313b1
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of 17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details. 19 ;; General Public License for more details.
20 20
21 ;; You should have received a copy of the GNU General Public License 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 22 ;; along with XEmacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA. 24 ;; Boston, MA 02111-1307, USA.
25 25
26 ;;; Synched up with: FSF 19.30 (select.el). 26 ;;; Synched up with: FSF 19.30 (select.el).
27 27
43 If a list is provided, the types are tried in sequence until 43 If a list is provided, the types are tried in sequence until
44 there is a successful conversion.") 44 there is a successful conversion.")
45 45
46 (defun x-get-selection (&optional type data-type) 46 (defun x-get-selection (&optional type data-type)
47 "Return the value of an X Windows selection. 47 "Return the value of an X Windows selection.
48 The argument TYPE (default `PRIMARY') says which selection, 48 The argument TYPE (default `PRIMARY') says which selection,
49 and the argument DATA-TYPE (default `STRING', or `COMPOUND_TEXT' under Mule) 49 and the argument DATA-TYPE (default `STRING', or `COMPOUND_TEXT' under Mule)
50 says how to convert the data." 50 says how to convert the data."
51 (or type (setq type 'PRIMARY)) 51 (or type (setq type 'PRIMARY))
52 (or data-type (setq data-type x-selected-text-type)) 52 (or data-type (setq data-type x-selected-text-type))
53 (let ((text 53 (let ((text
147 147
148 ;; FSFmacs calls this `x-set-selection', and reverses the 148 ;; FSFmacs calls this `x-set-selection', and reverses the
149 ;; arguments (duh ...). This order is more logical. 149 ;; arguments (duh ...). This order is more logical.
150 (defun x-own-selection (data &optional type) 150 (defun x-own-selection (data &optional type)
151 "Make an X Windows selection of type TYPE and value DATA. 151 "Make an X Windows selection of type TYPE and value DATA.
152 The argument TYPE (default `PRIMARY') says which selection, 152 The argument TYPE (default `PRIMARY') says which selection,
153 and DATA specifies the contents. DATA may be a string, 153 and DATA specifies the contents. DATA may be a string,
154 a symbol, an integer (or a cons of two integers or list of two integers). 154 a symbol, an integer (or a cons of two integers or list of two integers).
155 155
156 The selection may also be a cons of two markers pointing to the same buffer, 156 The selection may also be a cons of two markers pointing to the same buffer,
157 or an overlay. In these cases, the selection is considered to be the text 157 or an overlay. In these cases, the selection is considered to be the text
158 between the markers *at whatever time the selection is examined*. 158 between the markers *at whatever time the selection is examined*.
159 Thus, editing done in the buffer after you specify the selection 159 Thus, editing done in the buffer after you specify the selection
160 can alter the effective value of the selection. 160 can alter the effective value of the selection.
161 161
162 The data may also be a vector of valid non-vector selection values. 162 The data may also be a vector of valid non-vector selection values.
213 (marker-buffer (cdr data))) 213 (marker-buffer (cdr data)))
214 (buffer-live-p (marker-buffer (car data))) 214 (buffer-live-p (marker-buffer (car data)))
215 (buffer-live-p (marker-buffer (cdr data)))))) 215 (buffer-live-p (marker-buffer (cdr data))))))
216 216
217 (defun x-own-secondary-selection (selection &optional type) 217 (defun x-own-secondary-selection (selection &optional type)
218 "Make a secondary X Selection of the given argument. The argument may be a 218 "Make a secondary X Selection of the given argument. The argument may be a
219 string or a cons of two markers (in which case the selection is considered to 219 string or a cons of two markers (in which case the selection is considered to
220 be the text between those markers)." 220 be the text between those markers)."
221 (interactive (if (not current-prefix-arg) 221 (interactive (if (not current-prefix-arg)
222 (list (read-string "Store text for pasting: ")) 222 (list (read-string "Store text for pasting: "))
223 (list (cons ;; these need not be ordered. 223 (list (cons ;; these need not be ordered.
273 ;(setq x-sent-selection-hooks 'x-notice-selection-requests) 273 ;(setq x-sent-selection-hooks 'x-notice-selection-requests)
274 ;(setq x-sent-selection-hooks 'x-notice-selection-failures) 274 ;(setq x-sent-selection-hooks 'x-notice-selection-failures)
275 275
276 276
277 ;;; Selections in killed buffers 277 ;;; Selections in killed buffers
278 ;;; this function is called by kill-buffer as if it were on the 278 ;;; this function is called by kill-buffer as if it were on the
279 ;;; kill-buffer-hook (though it isn't really). 279 ;;; kill-buffer-hook (though it isn't really).
280 280
281 (defun xselect-kill-buffer-hook () 281 (defun xselect-kill-buffer-hook ()
282 ;; Probably the right thing is to write a C function to return a list 282 ;; Probably the right thing is to write a C function to return a list
283 ;; of the selections which emacs owns, since it could conceivably own 283 ;; of the selections which emacs owns, since it could conceivably own
306 306
307 ;;; Cut Buffer support 307 ;;; Cut Buffer support
308 308
309 ;;; FSF name x-get-cut-buffer 309 ;;; FSF name x-get-cut-buffer
310 (defun x-get-cutbuffer (&optional which-one) 310 (defun x-get-cutbuffer (&optional which-one)
311 "Returns the value of one of the 8 X server cut buffers. Optional arg 311 "Return the value of one of the 8 X server cut buffers.
312 WHICH-ONE should be a number from 0 to 7, defaulting to 0. 312 Optional arg WHICH-ONE should be a number from 0 to 7, defaulting to 0.
313 Cut buffers are considered obsolete\; you should use selections instead. 313 Cut buffers are considered obsolete; you should use selections instead.
314 This function does nothing if support for cut buffers was not compiled 314 This function does nothing if support for cut buffers was not compiled
315 into Emacs." 315 into Emacs."
316 (and (fboundp 'x-get-cutbuffer-internal) 316 (and (fboundp 'x-get-cutbuffer-internal)
317 (x-get-cutbuffer-internal 317 (x-get-cutbuffer-internal
318 (if which-one 318 (if which-one