X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fselect.el;h=f21d44090e3204a368fbd27c59210c6c7e94a1ab;hb=667a2b3a2dbea07c3c228e17d986110cc6a33084;hp=db01d6aaca9aa88bc5e0cb3e8e5e08a971b31bca;hpb=113b194be934327de99a168d809271db252c07c4;p=chise%2Fxemacs-chise.git diff --git a/lisp/select.el b/lisp/select.el index db01d6a..f21d440 100644 --- a/lisp/select.el +++ b/lisp/select.el @@ -40,6 +40,11 @@ COMPOUND_TEXT and STRING are the most commonly used data types. If a list is provided, the types are tried in sequence until there is a successful conversion.") +(defvar selection-sets-clipboard nil + "Controls the selection's relationship to the clipboard. +When non-nil, any operation that sets the primary selection will also +set the clipboard.") + (defun copy-primary-selection () "Copy the selection to the Clipboard and the kill ring." (interactive) @@ -70,11 +75,18 @@ there is a successful conversion.") "Return the value of one of the cut buffers. This will do nothing under anything other than X.") +(defun get-selection-no-error (&optional type data-type) + "Return the value of a Windows selection. +The argument TYPE (default `PRIMARY') says which selection, +and the argument DATA-TYPE (default `STRING', or `COMPOUND_TEXT' under Mule) +says how to convert the data. Returns NIL if there is no selection" + (condition-case err (get-selection type data-type) (t nil))) + (defun get-selection (&optional type data-type) "Return the value of a Windows selection. The argument TYPE (default `PRIMARY') says which selection, and the argument DATA-TYPE (default `STRING', or `COMPOUND_TEXT' under Mule) -says how to convert the data." +says how to convert the data. If there is no selection an error is signalled." (or type (setq type 'PRIMARY)) (or data-type (setq data-type selected-text-type)) (let ((text @@ -127,9 +139,12 @@ Interactively, the text of the region is used as the selection value." valid)) (signal 'error (list "invalid selection" data))) (or type (setq type 'PRIMARY)) - (if data - (own-selection-internal type data) - (disown-selection-internal type)) + (if (null data) + (disown-selection-internal type) + (own-selection-internal type data) + (when (and (eq type 'PRIMARY) + selection-sets-clipboard) + (own-selection-internal 'CLIPBOARD data))) (cond ((eq type 'PRIMARY) (setq primary-selection-extent (select-make-extent-for-selection