comparison lisp/term/x-win.el @ 83231:549734260e34

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-714 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-271
author Karoly Lorentey <lorentey@elte.hu>
date Wed, 08 Dec 2004 22:20:27 +0000
parents b15f799f66b5 b742505dc5c4
children 886073e54ccb
comparison
equal deleted inserted replaced
83230:d8738586aaec 83231:549734260e34
2099 pasted text.") 2099 pasted text.")
2100 (defvar x-last-selected-text-primary nil 2100 (defvar x-last-selected-text-primary nil
2101 "The value of the PRIMARY X selection last time we selected or 2101 "The value of the PRIMARY X selection last time we selected or
2102 pasted text.") 2102 pasted text.")
2103 (defvar x-last-selected-text-cut nil 2103 (defvar x-last-selected-text-cut nil
2104 "The value of the X cut buffer last time we selected or pasted text.") 2104 "The value of the X cut buffer last time we selected or pasted text.
2105 The actual text stored in the X cut buffer is what encoded from this value.")
2106 (defvar x-last-selected-text-cut-encoded nil
2107 "The value of the X cut buffer last time we selected or pasted text.
2108 This is the actual text stored in the X cut buffer.")
2105 2109
2106 ;;; It is said that overlarge strings are slow to put into the cut buffer. 2110 ;;; It is said that overlarge strings are slow to put into the cut buffer.
2107 ;;; Note this value is overridden below. 2111 ;;; Note this value is overridden below.
2108 (defvar x-cut-buffer-max 20000 2112 (defvar x-cut-buffer-max 20000
2109 "Max number of characters to put in the cut buffer.") 2113 "Max number of characters to put in the cut buffer.")
2122 (defun x-select-text (text &optional push) 2126 (defun x-select-text (text &optional push)
2123 ;; Don't send the cut buffer too much text. 2127 ;; Don't send the cut buffer too much text.
2124 ;; It becomes slow, and if really big it causes errors. 2128 ;; It becomes slow, and if really big it causes errors.
2125 (cond ((>= (length text) x-cut-buffer-max) 2129 (cond ((>= (length text) x-cut-buffer-max)
2126 (x-set-cut-buffer "" push) 2130 (x-set-cut-buffer "" push)
2127 (setq x-last-selected-text-cut "")) 2131 (setq x-last-selected-text-cut ""
2128 ;; Don't store a multibyte string that contains 2132 x-last-selected-text-cut-encoded ""))
2129 ;; eight-bit-control/graphic chars because they can't be
2130 ;; restored correctly by x-get-cut-buffer.
2131 ((and (multibyte-string-p text)
2132 (let ((charsets (find-charset-string text)))
2133 (or (memq 'eight-bit-control charsets)
2134 (memq 'eight-bit-graphic charsets))))
2135 (x-set-cut-buffer "" push)
2136 (setq x-last-selected-text-cut ""))
2137 (t 2133 (t
2138 (x-set-cut-buffer text push) 2134 (setq x-last-selected-text-cut text
2139 (setq x-last-selected-text-cut text))) 2135 x-last-selected-text-cut-encoded
2136 (encode-coding-string text (or locale-coding-system
2137 'iso-latin-1)))
2138 (x-set-cut-buffer x-last-selected-text-cut-encoded push)))
2140 (x-set-selection 'PRIMARY text) 2139 (x-set-selection 'PRIMARY text)
2141 (setq x-last-selected-text-primary text) 2140 (setq x-last-selected-text-primary text)
2142 (when x-select-enable-clipboard 2141 (when x-select-enable-clipboard
2143 (x-set-selection 'CLIPBOARD text) 2142 (x-set-selection 'CLIPBOARD text)
2144 (setq x-last-selected-text-clipboard text)) 2143 (setq x-last-selected-text-clipboard text))
2294 2293
2295 ;; Check the x cut buffer for 'newness', is it different 2294 ;; Check the x cut buffer for 'newness', is it different
2296 ;; from what we remebered them to be last time we did a 2295 ;; from what we remebered them to be last time we did a
2297 ;; cut/paste operation. 2296 ;; cut/paste operation.
2298 (setq cut-text 2297 (setq cut-text
2299 (cond;; check primary selection 2298 (cond;; check cut buffer
2300 ((or (not cut-text) (string= cut-text "")) 2299 ((or (not cut-text) (string= cut-text ""))
2301 (setq x-last-selected-text-cut nil)) 2300 (setq x-last-selected-text-cut nil))
2302 ((eq cut-text x-last-selected-text-cut) nil) 2301 ;; This short cut doesn't work because x-get-cut-buffer
2303 ((string= cut-text x-last-selected-text-cut) 2302 ;; always returns a newly created string.
2303 ;; ((eq cut-text x-last-selected-text-cut) nil)
2304 ((string= cut-text x-last-selected-text-cut-encoded)
2305 ;; See the comment above. No need of this recording.
2304 ;; Record the newer string, 2306 ;; Record the newer string,
2305 ;; so subsequent calls can use the `eq' test. 2307 ;; so subsequent calls can use the `eq' test.
2306 (setq x-last-selected-text-cut cut-text) 2308 ;; (setq x-last-selected-text-cut cut-text)
2307 nil) 2309 nil)
2308 (t 2310 (t
2309 (setq x-last-selected-text-cut cut-text)))) 2311 (setq x-last-selected-text-cut-encoded cut-text
2312 x-last-selected-text-cut
2313 (decode-coding-string cut-text (or locale-coding-system
2314 'iso-latin-1))))))
2310 2315
2311 ;; As we have done one selection, clear this now. 2316 ;; As we have done one selection, clear this now.
2312 (setq next-selection-coding-system nil) 2317 (setq next-selection-coding-system nil)
2313 2318
2314 ;; At this point we have recorded the current values for the 2319 ;; At this point we have recorded the current values for the