comparison lisp/x-select.el @ 416:ebe98a74bd68 r21-2-16

Import from CVS: tag r21-2-16
author cvs
date Mon, 13 Aug 2007 11:22:23 +0200
parents da8ed4261e83
children 11054d720c21
comparison
equal deleted inserted replaced
415:a27f76b40c83 416:ebe98a74bd68
48 (define-obsolete-function-alias 'x-kill-primary-selection 'kill-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 49 (define-obsolete-function-alias 'x-select-make-extent-for-selection
50 '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) 51 (define-obsolete-function-alias 'x-cut-copy-clear-internal 'cut-copy-clear-internal)
52 (define-obsolete-function-alias 'x-get-selection 'get-selection) 52 (define-obsolete-function-alias 'x-get-selection 'get-selection)
53 (define-obsolete-function-alias 'x-disown-selection-internal
54 'disown-selection-internal)
53 55
54 (defun x-get-secondary-selection () 56 (defun x-get-secondary-selection ()
55 "Return text selected from some X window." 57 "Return text selected from some X window."
56 (get-selection 'SECONDARY)) 58 (get-selection 'SECONDARY))
57 59
66 (interactive (if (not current-prefix-arg) 68 (interactive (if (not current-prefix-arg)
67 (list (read-string "Store text for pasting: ")) 69 (list (read-string "Store text for pasting: "))
68 (list (cons ;; these need not be ordered. 70 (list (cons ;; these need not be ordered.
69 (copy-marker (point-marker)) 71 (copy-marker (point-marker))
70 (copy-marker (mark-marker)))))) 72 (copy-marker (mark-marker))))))
71 (x-own-selection selection 'SECONDARY)) 73 (own-selection selection 'SECONDARY))
72 74
73 (defun x-notice-selection-requests (selection type successful) 75 (defun x-notice-selection-requests (selection type successful)
74 "for possible use as the value of x-sent-selection-hooks." 76 "for possible use as the value of x-sent-selection-hooks."
75 (if (not successful) 77 (if (not successful)
76 (message "Selection request failed to convert %s to %s" 78 (message "Selection request failed to convert %s to %s"
99 (xselect-kill-buffer-hook-1 'SECONDARY) 101 (xselect-kill-buffer-hook-1 'SECONDARY)
100 (xselect-kill-buffer-hook-1 'CLIPBOARD)) 102 (xselect-kill-buffer-hook-1 'CLIPBOARD))
101 103
102 (defun xselect-kill-buffer-hook-1 (selection) 104 (defun xselect-kill-buffer-hook-1 (selection)
103 (let (value) 105 (let (value)
104 (if (and (x-selection-owner-p selection) 106 (if (and (selection-owner-p selection)
105 (setq value (get-selection-internal selection '_EMACS_INTERNAL)) 107 (setq value (get-selection-internal selection '_EMACS_INTERNAL))
106 ;; The _EMACS_INTERNAL selection type has a converter registered 108 ;; The _EMACS_INTERNAL selection type has a converter registered
107 ;; for it that does no translation. This only works if emacs is 109 ;; for it that does no translation. This only works if emacs is
108 ;; requesting the selection from itself. We could have done this 110 ;; requesting the selection from itself. We could have done this
109 ;; by writing a C function to return the raw selection data, and 111 ;; by writing a C function to return the raw selection data, and
112 (markerp (car value)) 114 (markerp (car value))
113 (eq (current-buffer) (marker-buffer (car value)))) 115 (eq (current-buffer) (marker-buffer (car value))))
114 (and (extent-live-p value) 116 (and (extent-live-p value)
115 (eq (current-buffer) (extent-object value))) 117 (eq (current-buffer) (extent-object value)))
116 (and (extentp value) (not (extent-live-p value))))) 118 (and (extentp value) (not (extent-live-p value)))))
117 (x-disown-selection-internal selection)))) 119 (disown-selection-internal selection))))
118 120
119 121
120 ;;; Cut Buffer support 122 ;;; Cut Buffer support
121 123
122 ;;; FSF name x-get-cut-buffer 124 ;;; FSF name x-get-cut-buffer