aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/select.el
diff options
context:
space:
mode:
authorKenichi Handa2003-06-17 10:54:39 +0000
committerKenichi Handa2003-06-17 10:54:39 +0000
commitf147fd76db3f412d36c2d764dcce44c91b307ca8 (patch)
tree214c5ce91d2329dadbb0c2b4990075f1fe84d744 /lisp/select.el
parent0c6db68bc0f044e1e8b4b3a05cc08a4715350ada (diff)
downloademacs-f147fd76db3f412d36c2d764dcce44c91b307ca8.tar.gz
emacs-f147fd76db3f412d36c2d764dcce44c91b307ca8.zip
(x-get-selection): If the string returned by
x-get-selection-internal has text property `foreign-selection', decode it while preserving that property.
Diffstat (limited to 'lisp/select.el')
-rw-r--r--lisp/select.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/select.el b/lisp/select.el
index 618e10f4021..f679b27805a 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -38,7 +38,18 @@ how to convert the data.
38TYPE may be `SECONDARY' or `CLIPBOARD', in addition to `PRIMARY'. 38TYPE may be `SECONDARY' or `CLIPBOARD', in addition to `PRIMARY'.
39DATA-TYPE is usually `STRING', but can also be one of the symbols 39DATA-TYPE is usually `STRING', but can also be one of the symbols
40in `selection-converter-alist', which see." 40in `selection-converter-alist', which see."
41 (x-get-selection-internal (or type 'PRIMARY) (or data-type 'STRING))) 41 (let ((data (x-get-selection-internal (or type 'PRIMARY)
42 (or data-type 'STRING)))
43 coding)
44 (when (and (stringp data)
45 (setq data-type (get-text-property 0 'foreign-selection data)))
46 (setq coding (if (eq data-type 'UTF8_STRING)
47 'utf-8
48 (or next-selection-coding-system
49 selection-coding-system))
50 data (decode-coding-string data coding))
51 (put-text-property 0 (length data) 'foreign-selection data-type data))
52 data))
42 53
43(defun x-get-clipboard () 54(defun x-get-clipboard ()
44 "Return text pasted to the clipboard." 55 "Return text pasted to the clipboard."