X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fselect.el;h=ef3072e3f047e5f95ab7c4a29e94e5db4107bc3f;hb=fd3b637227a2cc7bce0abebc2f314ffd2398b18c;hp=f21d44090e3204a368fbd27c59210c6c7e94a1ab;hpb=44e716ef11bd794a51f8c5b56c4f3f10a7dbf217;p=chise%2Fxemacs-chise.git- diff --git a/lisp/select.el b/lisp/select.el index f21d440..ef3072e 100644 --- a/lisp/select.el +++ b/lisp/select.el @@ -66,10 +66,17 @@ set the clipboard.") (defun yank-clipboard-selection () "Insert the current Clipboard selection at point." (interactive "*") - (case (device-type (selected-device)) - (x (x-yank-clipboard-selection)) - (mswindows (mswindows-paste-clipboard)) - (otherwise nil))) + (when (console-on-window-system-p) + (setq last-command nil) + (setq this-command 'yank) ; so that yank-pop works. + (let ((clip (get-clipboard))) + (or clip (error "there is no clipboard selection")) + (push-mark) + (insert clip)))) + +(defun get-clipboard () + "Return text pasted to the clipboard." + (get-selection 'CLIPBOARD)) (define-device-method get-cutbuffer "Return the value of one of the cut buffers. @@ -178,13 +185,18 @@ Interactively, the text of the region is used as the selection value." (setq lost-selection-hooks 'dehilight-selection) (defun own-clipboard (string) - "Paste the given string to the X Clipboard." + "Paste the given string to the window system Clipboard." (own-selection string 'CLIPBOARD)) (defun disown-selection (&optional secondary-p) "Assuming we own the selection, disown it. With an argument, discard the secondary selection instead of the primary selection." - (disown-selection-internal (if secondary-p 'SECONDARY 'PRIMARY))) + (disown-selection-internal (if secondary-p 'SECONDARY 'PRIMARY)) + (when (and selection-sets-clipboard + (or (not secondary-p) + (eq secondary-p 'PRIMARY) + (eq secondary-p 'CLIPBOARD))) + (disown-selection-internal 'CLIPBOARD))) ;; from x-init.el ;; selections and active regions