aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-07-25 20:30:04 +0000
committerRichard M. Stallman1993-07-25 20:30:04 +0000
commit2666a6a5b92e869e00a35453aa6a66887b1307a8 (patch)
tree99eae35a0dbc358e6b2b10d61ef398d8ba6a37ef
parent799412761b17d9a8b51377a45e23175e5fc26b6f (diff)
downloademacs-2666a6a5b92e869e00a35453aa6a66887b1307a8.tar.gz
emacs-2666a6a5b92e869e00a35453aa6a66887b1307a8.zip
(x-select-text): Never set the CLIPBOARD selection.
(x-cut-buffer-or-selection-value): Try PRIMARY before cut buffer. (x-cut-buffer-max): Set based on x-server-max-request-size.
-rw-r--r--lisp/term/x-win.el26
1 files changed, 12 insertions, 14 deletions
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index f853788075a..807aa5e2bf4 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -491,23 +491,21 @@ This returns ARGS with the arguments that have been processed removed."
491;;; from x-cut-buffer-or-selection-value. 491;;; from x-cut-buffer-or-selection-value.
492(defvar x-last-selected-text nil) 492(defvar x-last-selected-text nil)
493 493
494;;; It is said that overlarge strings are slow to put into the cut buffer, 494;;; It is said that overlarge strings are slow to put into the cut buffer.
495;;; and would crash the clipboard. 495(defvar x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
496(defvar x-cut-buffer-max 20000 496 20000)
497 "Max number of characters to put in the cut buffer or clipboard.") 497 "Max number of characters to put in the cut buffer.")
498 498
499;;; Make TEXT, a string, the primary and clipboard X selections. 499;;; Make TEXT, a string, the primary X selection.
500;;; If you are running xclipboard, this means you can effectively
501;;; have a window on a copy of the kill-ring.
502;;; Also, set the value of X cut buffer 0, for backward compatibility 500;;; Also, set the value of X cut buffer 0, for backward compatibility
503;;; with older X applications. 501;;; with older X applications.
502;;; gildea@lcs.mit.edu says it's not desirable to put kills
503;;; in the clipboard.
504(defun x-select-text (text &optional push) 504(defun x-select-text (text &optional push)
505 ;; Don't send the cut buffer too much text. 505 ;; Don't send the cut buffer too much text.
506 ;; It becomes slow, and if really big it causes errors. 506 ;; It becomes slow, and if really big it causes errors.
507 (if (< (length text) x-cut-buffer-max) 507 (if (< (length text) x-cut-buffer-max)
508 (progn 508 (x-set-cut-buffer text push)
509 (x-set-cut-buffer text push)
510 (x-set-selection 'CLIPBOARD text))
511 (x-set-cut-buffer "" push)) 509 (x-set-cut-buffer "" push))
512 (x-set-selection 'PRIMARY text) 510 (x-set-selection 'PRIMARY text)
513 (setq x-last-selected-text text)) 511 (setq x-last-selected-text text))
@@ -518,12 +516,12 @@ This returns ARGS with the arguments that have been processed removed."
518(defun x-cut-buffer-or-selection-value () 516(defun x-cut-buffer-or-selection-value ()
519 (let (text) 517 (let (text)
520 518
521 ;; Consult the cut buffer, then the selection. Treat empty strings 519 ;; Consult the selection, then the cut buffer. Treat empty strings
522 ;; as if they were unset. 520 ;; as if they were unset.
523 (setq text (x-get-cut-buffer 0))
524 (if (string= text "") (setq text nil))
525 (or text (setq text (x-get-selection 'PRIMARY))) 521 (or text (setq text (x-get-selection 'PRIMARY)))
526 (if (string= text "") (setq text nil)) 522 (if (string= text "") (setq text nil))
523 (setq text (x-get-cut-buffer 0))
524 (if (string= text "") (setq text nil))
527 525
528 (cond 526 (cond
529 ((not text) nil) 527 ((not text) nil)