• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/emacs-lisp/

Lines Matching +defs:own +defs:selection

10 ;; Based on Lucid's selection code.
33 ;; The selection code requires us to use certain symbols whose names are
39 (defvar x-lost-selection-functions)
45 (or (facep 'primary-selection)
46 (make-face 'primary-selection))
48 (or (facep 'secondary-selection)
49 (make-face 'secondary-selection))
51 (defun x-get-secondary-selection ()
53 (x-get-selection-internal 'SECONDARY 'STRING))
55 (defvar primary-selection-extent nil
56 "The extent of the primary selection; don't use this.")
58 (defvar secondary-selection-extent nil
59 "The extent of the secondary selection; don't use this.")
62 (defun x-select-make-extent-for-selection (selection previous-extent face)
63 ;; Given a selection, this makes an extent in the buffer which holds that
64 ;; selection, for highlighting purposes. If the selection isn't associated
71 (cond ((stringp selection)
73 ;; to highlight the selection.
75 ((consp selection)
76 (setq start (min (car selection) (cdr selection))
77 end (max (car selection) (cdr selection))
79 (eq (marker-buffer (car selection))
81 buffer (marker-buffer (car selection))))
82 ((extentp selection)
83 (setq start (extent-start-position selection)
84 end (extent-end-position selection)
86 (eq (extent-buffer selection)
88 buffer (extent-buffer selection)))
103 ;; the selection extent and a mouse-highlighted extent are resolved
109 (defun x-own-selection (selection &optional type)
112 In the latter cases the selection is considered to be the text
120 (x-set-selection selection type)
122 (setq primary-selection-extent
123 (x-select-make-extent-for-selection
124 selection primary-selection-extent 'primary-selection)))
126 (setq secondary-selection-extent
127 (x-select-make-extent-for-selection
128 selection secondary-selection-extent 'secondary-selection))))
129 selection)
132 (defun x-own-secondary-selection (selection &optional type)
134 string or a cons of two markers (in which case the selection is considered to
141 (x-own-selection selection 'SECONDARY))
144 (defun x-own-clipboard (string)
146 (x-own-selection string 'CLIPBOARD))
149 (defun x-disown-selection (&optional secondary-p)
150 "Assuming we own the selection, disown it. With an argument, discard the
151 secondary selection instead of the primary selection."
152 (x-disown-selection-internal (if secondary-p 'SECONDARY 'PRIMARY)))
154 (defun x-dehilight-selection (selection)
155 "for use as a value of `x-lost-selection-functions'."
156 (cond ((eq selection 'PRIMARY)
157 (if primary-selection-extent
159 (delete-extent primary-selection-extent)
160 (setq primary-selection-extent nil)))
162 ((eq selection 'SECONDARY)
163 (if secondary-selection-extent
165 (delete-extent secondary-selection-extent)
166 (setq secondary-selection-extent nil)))))
169 (setq x-lost-selection-functions 'x-dehilight-selection)
171 (defun x-notice-selection-requests (selection type successful)
172 "for possible use as the value of `x-sent-selection-functions'."
175 selection type)
176 (message "Sent selection %s as %s" selection type)))
178 (defun x-notice-selection-failures (selection type successful)
179 "for possible use as the value of `x-sent-selection-functions'."
182 selection type)))
184 ;(setq x-sent-selection-functions 'x-notice-selection-requests)
185 ;(setq x-sent-selection-functions 'x-notice-selection-failures)
191 (defun x-kill-primary-selection ()
192 "If there is a selection, delete the text it covers, and copy it to
195 (or (x-selection-owner-p) (error "Emacs does not own the primary selection"))
197 (or primary-selection-extent
198 (error "the primary selection is not an extent?"))
200 (set-buffer (extent-buffer primary-selection-extent))
201 (kill-region (extent-start-position primary-selection-extent)
202 (extent-end-position primary-selection-extent)))
203 (x-disown-selection nil))
205 (defun x-delete-primary-selection ()
206 "If there is a selection, delete the text it covers *without* copying it to
209 (or (x-selection-owner-p) (error "Emacs does not own the primary selection"))
211 (or primary-selection-extent
212 (error "the primary selection is not an extent?"))
214 (set-buffer (extent-buffer primary-selection-extent))
215 (delete-region (extent-start-position primary-selection-extent)
216 (extent-end-position primary-selection-extent)))
217 (x-disown-selection nil))
219 (defun x-copy-primary-selection ()
220 "If there is a selection, copy it to both the kill ring and the Clipboard."
223 (or (x-selection-owner-p) (error "Emacs does not own the primary selection"))
224 (or primary-selection-extent
225 (error "the primary selection is not an extent?"))
227 (set-buffer (extent-buffer primary-selection-extent))
228 (copy-region-as-kill (extent-start-position primary-selection-extent)
229 (extent-end-position primary-selection-extent))))
231 (defun x-yank-clipboard-selection ()
232 "If someone owns a Clipboard selection, insert it at point."
236 (or clip (error "there is no clipboard selection"))