Mercurial > emacs
changeset 87385:4f4b8e4f7e4e
(x-select-enable-primary): New option.
(x-select-text, x-cut-buffer-or-selection-value): Obey it.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 25 Dec 2007 19:55:59 +0000 |
parents | 20bb7aaa7b12 |
children | 9ec633b7a53d |
files | lisp/term/x-win.el |
diffstat | 1 files changed, 25 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/term/x-win.el Tue Dec 25 19:21:38 2007 +0000 +++ b/lisp/term/x-win.el Tue Dec 25 19:55:59 2007 +0000 @@ -2173,6 +2173,11 @@ :type 'boolean :group 'killing) +(defcustom x-select-enable-primary t + "Non-nil means cutting and pasting uses the primary selection." + :type 'boolean + :group 'killing) + (defun x-select-text (text &optional push) "Make TEXT, a string, the primary X selection. Also, set the value of X cut buffer 0, for backward compatibility @@ -2194,8 +2199,9 @@ ;; ICCCM says cut buffer always contain ISO-Latin-1 (encode-coding-string text 'iso-latin-1)) (x-set-cut-buffer x-last-selected-text-cut-encoded push))) - (x-set-selection 'PRIMARY text) - (setq x-last-selected-text-primary text) + (when x-select-enable-primary + (x-set-selection 'PRIMARY text) + (setq x-last-selected-text-primary text)) (when x-select-enable-clipboard (x-set-selection 'CLIPBOARD text) (setq x-last-selected-text-clipboard text)))) @@ -2341,22 +2347,23 @@ nil) (t (setq x-last-selected-text-clipboard clip-text))))) - (setq primary-text (x-selection-value 'PRIMARY)) - ;; Check the PRIMARY selection for 'newness', is it different - ;; from what we remebered them to be last time we did a - ;; cut/paste operation. - (setq primary-text - (cond ;; check primary selection - ((or (not primary-text) (string= primary-text "")) - (setq x-last-selected-text-primary nil)) - ((eq primary-text x-last-selected-text-primary) nil) - ((string= primary-text x-last-selected-text-primary) - ;; Record the newer string, - ;; so subsequent calls can use the `eq' test. - (setq x-last-selected-text-primary primary-text) - nil) - (t - (setq x-last-selected-text-primary primary-text)))) + (when x-select-enable-primary + (setq primary-text (x-selection-value 'PRIMARY)) + ;; Check the PRIMARY selection for 'newness', is it different + ;; from what we remebered them to be last time we did a + ;; cut/paste operation. + (setq primary-text + (cond ;; check primary selection + ((or (not primary-text) (string= primary-text "")) + (setq x-last-selected-text-primary nil)) + ((eq primary-text x-last-selected-text-primary) nil) + ((string= primary-text x-last-selected-text-primary) + ;; Record the newer string, + ;; so subsequent calls can use the `eq' test. + (setq x-last-selected-text-primary primary-text) + nil) + (t + (setq x-last-selected-text-primary primary-text))))) (setq cut-text (x-get-cut-buffer 0))