comparison lisp/x-select.el @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 3ecd8885ac67
children 576fb035e263
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
86 86
87 ;(setq x-sent-selection-hooks 'x-notice-selection-requests) 87 ;(setq x-sent-selection-hooks 'x-notice-selection-requests)
88 ;(setq x-sent-selection-hooks 'x-notice-selection-failures) 88 ;(setq x-sent-selection-hooks 'x-notice-selection-failures)
89 89
90 90
91 ;;; Selections in killed buffers
92 ;;; this function is called by kill-buffer as if it were on the
93 ;;; kill-buffer-hook (though it isn't really).
94
95 (defun xselect-kill-buffer-hook ()
96 ;; Probably the right thing is to write a C function to return a list
97 ;; of the selections which emacs owns, since it could conceivably own
98 ;; a user-defined selection type that we've never heard of.
99 (xselect-kill-buffer-hook-1 'PRIMARY)
100 (xselect-kill-buffer-hook-1 'SECONDARY)
101 (xselect-kill-buffer-hook-1 'CLIPBOARD))
102
103 (defun xselect-kill-buffer-hook-1 (selection)
104 (let (value)
105 (if (and (selection-owner-p selection)
106 (setq value (get-selection-internal selection '_EMACS_INTERNAL))
107 ;; The _EMACS_INTERNAL selection type has a converter registered
108 ;; for it that does no translation. This only works if emacs is
109 ;; requesting the selection from itself. We could have done this
110 ;; by writing a C function to return the raw selection data, and
111 ;; that might be the right way to do this, but this was easy.
112 (or (and (consp value)
113 (markerp (car value))
114 (eq (current-buffer) (marker-buffer (car value))))
115 (and (extent-live-p value)
116 (eq (current-buffer) (extent-object value)))
117 (and (extentp value) (not (extent-live-p value)))))
118 (disown-selection-internal selection))))
119
120
121 ;;; Cut Buffer support 91 ;;; Cut Buffer support
122 92
123 ;;; FSF name x-get-cut-buffer 93 ;;; FSF name x-get-cut-buffer
124 (defun x-get-cutbuffer (&optional which-one) 94 (defun x-get-cutbuffer (&optional which-one)
125 "Return the value of one of the 8 X server cut buffers. 95 "Return the value of one of the 8 X server cut buffers.