aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Djärv2006-11-20 07:43:41 +0000
committerJan Djärv2006-11-20 07:43:41 +0000
commit8eee81013fe8971c4f9eda85a1bbebde4b21b59c (patch)
tree23abef3b30410451d3efa44c19af40800898eb86
parent83dc6995148085966eddca749228a6338b7e6b0e (diff)
downloademacs-8eee81013fe8971c4f9eda85a1bbebde4b21b59c.tar.gz
emacs-8eee81013fe8971c4f9eda85a1bbebde4b21b59c.zip
(x-last-cut-buffer-coding): New variable.
(x-select-text): Set it. (x-cut-buffer-or-selection-value): Check also x-last-cut-buffer-coding when checking for newness.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/term/x-win.el31
2 files changed, 28 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 364a68d849a..ed928d5a123 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12006-11-20 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2
3 * term/x-win.el (x-last-cut-buffer-coding): New variable.
4 (x-select-text): Set it.
5 (x-cut-buffer-or-selection-value): Check also x-last-cut-buffer-coding
6 when checking for newness.
7
12006-11-19 Juanma Barranquero <lekktu@gmail.com> 82006-11-19 Juanma Barranquero <lekktu@gmail.com>
2 9
3 * subr.el (posn-image): 10 * subr.el (posn-image):
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index b0e2dc85a04..e97d3752704 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -2138,6 +2138,8 @@ The actual text stored in the X cut buffer is what encoded from this value.")
2138(defvar x-last-selected-text-cut-encoded nil 2138(defvar x-last-selected-text-cut-encoded nil
2139 "The value of the X cut buffer last time we selected or pasted text. 2139 "The value of the X cut buffer last time we selected or pasted text.
2140This is the actual text stored in the X cut buffer.") 2140This is the actual text stored in the X cut buffer.")
2141(defvar x-last-cut-buffer-coding 'iso-latin-1
2142 "The coding we last used to encode/decode the text from the X cut buffer")
2141 2143
2142(defvar x-cut-buffer-max 20000 ; Note this value is overridden below. 2144(defvar x-cut-buffer-max 20000 ; Note this value is overridden below.
2143 "Max number of characters to put in the cut buffer. 2145 "Max number of characters to put in the cut buffer.
@@ -2163,6 +2165,7 @@ in the clipboard."
2163 x-last-selected-text-cut-encoded "")) 2165 x-last-selected-text-cut-encoded ""))
2164 (t 2166 (t
2165 (setq x-last-selected-text-cut text 2167 (setq x-last-selected-text-cut text
2168 x-last-cut-buffer-coding 'iso-latin-1
2166 x-last-selected-text-cut-encoded 2169 x-last-selected-text-cut-encoded
2167 ;; ICCCM says cut buffer always contain ISO-Latin-1 2170 ;; ICCCM says cut buffer always contain ISO-Latin-1
2168 (encode-coding-string text 'iso-latin-1)) 2171 (encode-coding-string text 'iso-latin-1))
@@ -2331,20 +2334,28 @@ order until succeed.")
2331 ;; from what we remebered them to be last time we did a 2334 ;; from what we remebered them to be last time we did a
2332 ;; cut/paste operation. 2335 ;; cut/paste operation.
2333 (setq cut-text 2336 (setq cut-text
2334 (cond;; check cut buffer 2337 (let ((next-coding (or next-selection-coding-system 'iso-latin-1)))
2335 ((or (not cut-text) (string= cut-text "")) 2338 (cond;; check cut buffer
2336 (setq x-last-selected-text-cut nil)) 2339 ((or (not cut-text) (string= cut-text ""))
2337 (t 2340 (setq x-last-selected-text-cut nil))
2338 ;; We can not compare x-last-selected-text-cut-encoded with 2341 ;; This short cut doesn't work because x-get-cut-buffer
2339 ;; cut-text because the next-selection-coding-system may have changed 2342 ;; always returns a newly created string.
2340 ;; so we need to re-decode anyway. 2343 ;; ((eq cut-text x-last-selected-text-cut) nil)
2341 (setq x-last-selected-text-cut-encoded cut-text 2344 ((and (string= cut-text x-last-selected-text-cut-encoded)
2345 (eq x-last-cut-buffer-coding next-coding))
2346 ;; See the comment above. No need of this recording.
2347 ;; Record the newer string,
2348 ;; so subsequent calls can use the `eq' test.
2349 ;; (setq x-last-selected-text-cut cut-text)
2350 nil)
2351 (t
2352 (setq x-last-selected-text-cut-encoded cut-text
2353 x-last-cut-buffer-coding next-coding
2342 x-last-selected-text-cut 2354 x-last-selected-text-cut
2343 ;; ICCCM says cut buffer always contain ISO-Latin-1, but 2355 ;; ICCCM says cut buffer always contain ISO-Latin-1, but
2344 ;; use next-selection-coding-system if not nil. 2356 ;; use next-selection-coding-system if not nil.
2345 (decode-coding-string 2357 (decode-coding-string
2346 cut-text 2358 cut-text next-coding))))))
2347 (or next-selection-coding-system 'iso-latin-1))))))
2348 2359
2349 ;; As we have done one selection, clear this now. 2360 ;; As we have done one selection, clear this now.
2350 (setq next-selection-coding-system nil) 2361 (setq next-selection-coding-system nil)