diff options
| author | Richard M. Stallman | 2007-12-25 19:55:59 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2007-12-25 19:55:59 +0000 |
| commit | 73fe9da0c11055f604cc389db78d2d5596bd340b (patch) | |
| tree | 9cba9ee20c7d2154fa372bd9af9b1ddd90b196bb | |
| parent | d31e8e871c1942771b8b1296338cde5434882e84 (diff) | |
| download | emacs-73fe9da0c11055f604cc389db78d2d5596bd340b.tar.gz emacs-73fe9da0c11055f604cc389db78d2d5596bd340b.zip | |
(x-select-enable-primary): New option.
(x-select-text, x-cut-buffer-or-selection-value): Obey it.
| -rw-r--r-- | lisp/term/x-win.el | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 6cc64829434..66c5a272e1c 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el | |||
| @@ -2173,6 +2173,11 @@ This is in addition to, but in preference to, the primary selection." | |||
| 2173 | :type 'boolean | 2173 | :type 'boolean |
| 2174 | :group 'killing) | 2174 | :group 'killing) |
| 2175 | 2175 | ||
| 2176 | (defcustom x-select-enable-primary t | ||
| 2177 | "Non-nil means cutting and pasting uses the primary selection." | ||
| 2178 | :type 'boolean | ||
| 2179 | :group 'killing) | ||
| 2180 | |||
| 2176 | (defun x-select-text (text &optional push) | 2181 | (defun x-select-text (text &optional push) |
| 2177 | "Make TEXT, a string, the primary X selection. | 2182 | "Make TEXT, a string, the primary X selection. |
| 2178 | Also, set the value of X cut buffer 0, for backward compatibility | 2183 | Also, set the value of X cut buffer 0, for backward compatibility |
| @@ -2194,8 +2199,9 @@ in the clipboard." | |||
| 2194 | ;; ICCCM says cut buffer always contain ISO-Latin-1 | 2199 | ;; ICCCM says cut buffer always contain ISO-Latin-1 |
| 2195 | (encode-coding-string text 'iso-latin-1)) | 2200 | (encode-coding-string text 'iso-latin-1)) |
| 2196 | (x-set-cut-buffer x-last-selected-text-cut-encoded push))) | 2201 | (x-set-cut-buffer x-last-selected-text-cut-encoded push))) |
| 2197 | (x-set-selection 'PRIMARY text) | 2202 | (when x-select-enable-primary |
| 2198 | (setq x-last-selected-text-primary text) | 2203 | (x-set-selection 'PRIMARY text) |
| 2204 | (setq x-last-selected-text-primary text)) | ||
| 2199 | (when x-select-enable-clipboard | 2205 | (when x-select-enable-clipboard |
| 2200 | (x-set-selection 'CLIPBOARD text) | 2206 | (x-set-selection 'CLIPBOARD text) |
| 2201 | (setq x-last-selected-text-clipboard text)))) | 2207 | (setq x-last-selected-text-clipboard text)))) |
| @@ -2341,22 +2347,23 @@ order until succeed.") | |||
| 2341 | nil) | 2347 | nil) |
| 2342 | (t (setq x-last-selected-text-clipboard clip-text))))) | 2348 | (t (setq x-last-selected-text-clipboard clip-text))))) |
| 2343 | 2349 | ||
| 2344 | (setq primary-text (x-selection-value 'PRIMARY)) | 2350 | (when x-select-enable-primary |
| 2345 | ;; Check the PRIMARY selection for 'newness', is it different | 2351 | (setq primary-text (x-selection-value 'PRIMARY)) |
| 2346 | ;; from what we remebered them to be last time we did a | 2352 | ;; Check the PRIMARY selection for 'newness', is it different |
| 2347 | ;; cut/paste operation. | 2353 | ;; from what we remebered them to be last time we did a |
| 2348 | (setq primary-text | 2354 | ;; cut/paste operation. |
| 2349 | (cond ;; check primary selection | 2355 | (setq primary-text |
| 2350 | ((or (not primary-text) (string= primary-text "")) | 2356 | (cond ;; check primary selection |
| 2351 | (setq x-last-selected-text-primary nil)) | 2357 | ((or (not primary-text) (string= primary-text "")) |
| 2352 | ((eq primary-text x-last-selected-text-primary) nil) | 2358 | (setq x-last-selected-text-primary nil)) |
| 2353 | ((string= primary-text x-last-selected-text-primary) | 2359 | ((eq primary-text x-last-selected-text-primary) nil) |
| 2354 | ;; Record the newer string, | 2360 | ((string= primary-text x-last-selected-text-primary) |
| 2355 | ;; so subsequent calls can use the `eq' test. | 2361 | ;; Record the newer string, |
| 2356 | (setq x-last-selected-text-primary primary-text) | 2362 | ;; so subsequent calls can use the `eq' test. |
| 2357 | nil) | 2363 | (setq x-last-selected-text-primary primary-text) |
| 2358 | (t | 2364 | nil) |
| 2359 | (setq x-last-selected-text-primary primary-text)))) | 2365 | (t |
| 2366 | (setq x-last-selected-text-primary primary-text))))) | ||
| 2360 | 2367 | ||
| 2361 | (setq cut-text (x-get-cut-buffer 0)) | 2368 | (setq cut-text (x-get-cut-buffer 0)) |
| 2362 | 2369 | ||