# HG changeset patch # User Kenichi Handa # Date 1055847279 0 # Node ID 16b245345247dc22ae2030197573ddb15cab90a0 # Parent de897fd132ef34571f634c12aef2fc49b7bd3957 (x-get-selection): If the string returned by x-get-selection-internal has text property `foreign-selection', decode it while preserving that property. diff -r de897fd132ef -r 16b245345247 lisp/select.el --- a/lisp/select.el Tue Jun 17 10:52:01 2003 +0000 +++ b/lisp/select.el Tue Jun 17 10:54:39 2003 +0000 @@ -38,7 +38,18 @@ TYPE may be `SECONDARY' or `CLIPBOARD', in addition to `PRIMARY'. DATA-TYPE is usually `STRING', but can also be one of the symbols in `selection-converter-alist', which see." - (x-get-selection-internal (or type 'PRIMARY) (or data-type 'STRING))) + (let ((data (x-get-selection-internal (or type 'PRIMARY) + (or data-type 'STRING))) + coding) + (when (and (stringp data) + (setq data-type (get-text-property 0 'foreign-selection data))) + (setq coding (if (eq data-type 'UTF8_STRING) + 'utf-8 + (or next-selection-coding-system + selection-coding-system)) + data (decode-coding-string data coding)) + (put-text-property 0 (length data) 'foreign-selection data-type data)) + data)) (defun x-get-clipboard () "Return text pasted to the clipboard."