Mercurial > hg > xemacs-beta
comparison lisp/select.el @ 424:11054d720c21 r21-2-20
Import from CVS: tag r21-2-20
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:26:11 +0200 |
parents | e804706bfb8c |
children |
comparison
equal
deleted
inserted
replaced
423:28d9c139be4c | 424:11054d720c21 |
---|---|
64 (cut-copy-clear-internal 'clear))) | 64 (cut-copy-clear-internal 'clear))) |
65 | 65 |
66 (defun yank-clipboard-selection () | 66 (defun yank-clipboard-selection () |
67 "Insert the current Clipboard selection at point." | 67 "Insert the current Clipboard selection at point." |
68 (interactive "*") | 68 (interactive "*") |
69 (case (device-type (selected-device)) | 69 (when (console-on-window-system-p) |
70 (x (x-yank-clipboard-selection)) | 70 (setq last-command nil) |
71 (mswindows (mswindows-paste-clipboard)) | 71 (setq this-command 'yank) ; so that yank-pop works. |
72 (otherwise nil))) | 72 (let ((clip (get-clipboard))) |
73 (or clip (error "there is no clipboard selection")) | |
74 (push-mark) | |
75 (insert clip)))) | |
76 | |
77 (defun get-clipboard () | |
78 "Return text pasted to the clipboard." | |
79 (get-selection 'CLIPBOARD)) | |
73 | 80 |
74 (define-device-method get-cutbuffer | 81 (define-device-method get-cutbuffer |
75 "Return the value of one of the cut buffers. | 82 "Return the value of one of the cut buffers. |
76 This will do nothing under anything other than X.") | 83 This will do nothing under anything other than X.") |
77 | 84 |
176 nil) | 183 nil) |
177 | 184 |
178 (setq lost-selection-hooks 'dehilight-selection) | 185 (setq lost-selection-hooks 'dehilight-selection) |
179 | 186 |
180 (defun own-clipboard (string) | 187 (defun own-clipboard (string) |
181 "Paste the given string to the X Clipboard." | 188 "Paste the given string to the window system Clipboard." |
182 (own-selection string 'CLIPBOARD)) | 189 (own-selection string 'CLIPBOARD)) |
183 | 190 |
184 (defun disown-selection (&optional secondary-p) | 191 (defun disown-selection (&optional secondary-p) |
185 "Assuming we own the selection, disown it. With an argument, discard the | 192 "Assuming we own the selection, disown it. With an argument, discard the |
186 secondary selection instead of the primary selection." | 193 secondary selection instead of the primary selection." |
187 (disown-selection-internal (if secondary-p 'SECONDARY 'PRIMARY))) | 194 (disown-selection-internal (if secondary-p 'SECONDARY 'PRIMARY)) |
195 (when (and selection-sets-clipboard | |
196 (or (not secondary-p) | |
197 (eq secondary-p 'PRIMARY) | |
198 (eq secondary-p 'CLIPBOARD))) | |
199 (disown-selection-internal 'CLIPBOARD))) | |
188 | 200 |
189 ;; from x-init.el | 201 ;; from x-init.el |
190 ;; selections and active regions | 202 ;; selections and active regions |
191 | 203 |
192 ;; If and only if zmacs-regions is true: | 204 ;; If and only if zmacs-regions is true: |