diff options
| author | Chong Yidong | 2008-04-21 02:02:01 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-04-21 02:02:01 +0000 |
| commit | 569ac23f8a6f847aa57e1ff6bd6d321391f06c32 (patch) | |
| tree | 3c86079ef31d9eaddc8f3766351d811eb99beb49 | |
| parent | 9ba76e6b5f751a9c28c5ecc8b44f395aee44adcd (diff) | |
| download | emacs-569ac23f8a6f847aa57e1ff6bd6d321391f06c32.tar.gz emacs-569ac23f8a6f847aa57e1ff6bd6d321391f06c32.zip | |
(xselect-convert-to-string): Send a C_STRING only if the polymorphic
target TEXT is requested.
| -rw-r--r-- | lisp/select.el | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/lisp/select.el b/lisp/select.el index a283a6633b1..0a61150a06a 100644 --- a/lisp/select.el +++ b/lisp/select.el | |||
| @@ -241,13 +241,12 @@ Cut buffers are considered obsolete; you should use selections instead." | |||
| 241 | (let ((inhibit-read-only t)) | 241 | (let ((inhibit-read-only t)) |
| 242 | ;; Suppress producing escape sequences for compositions. | 242 | ;; Suppress producing escape sequences for compositions. |
| 243 | (remove-text-properties 0 (length str) '(composition nil) str) | 243 | (remove-text-properties 0 (length str) '(composition nil) str) |
| 244 | (if (not (multibyte-string-p str)) | 244 | (if (eq type 'TEXT) |
| 245 | ;; Don't have to encode unibyte string. | 245 | ;; TEXT is a polymorphic target. We must select the |
| 246 | (setq type 'C_STRING) | 246 | ;; actual type from `UTF8_STRING', `COMPOUND_TEXT', |
| 247 | (if (eq type 'TEXT) | 247 | ;; `STRING', and `C_STRING'. |
| 248 | ;; TEXT is a polimorphic target. We must select the | 248 | (if (not (multibyte-string-p str)) |
| 249 | ;; actual type from `UTF8_STRING', `COMPOUND_TEXT', | 249 | (setq type 'C_STRING) |
| 250 | ;; `STRING', and `C_STRING'. | ||
| 251 | (let (non-latin-1 non-unicode eight-bit) | 250 | (let (non-latin-1 non-unicode eight-bit) |
| 252 | (mapc #'(lambda (x) | 251 | (mapc #'(lambda (x) |
| 253 | (if (>= x #x100) | 252 | (if (>= x #x100) |
| @@ -259,32 +258,32 @@ Cut buffers are considered obsolete; you should use selections instead." | |||
| 259 | str) | 258 | str) |
| 260 | (setq type (if non-unicode 'COMPOUND_TEXT | 259 | (setq type (if non-unicode 'COMPOUND_TEXT |
| 261 | (if non-latin-1 'UTF8_STRING | 260 | (if non-latin-1 'UTF8_STRING |
| 262 | (if eight-bit 'C_STRING 'STRING)))))) | 261 | (if eight-bit 'C_STRING 'STRING))))))) |
| 263 | (cond | 262 | (cond |
| 264 | ((eq type 'UTF8_STRING) | 263 | ((eq type 'UTF8_STRING) |
| 265 | (if (or (not coding) | 264 | (if (or (not coding) |
| 266 | (not (eq (coding-system-type coding) 'utf-8))) | 265 | (not (eq (coding-system-type coding) 'utf-8))) |
| 267 | (setq coding 'utf-8)) | 266 | (setq coding 'utf-8)) |
| 268 | (setq str (encode-coding-string str coding))) | 267 | (setq str (encode-coding-string str coding))) |
| 269 | 268 | ||
| 270 | ((eq type 'STRING) | 269 | ((eq type 'STRING) |
| 271 | (if (or (not coding) | 270 | (if (or (not coding) |
| 272 | (not (eq (coding-system-type coding) 'charset))) | 271 | (not (eq (coding-system-type coding) 'charset))) |
| 273 | (setq coding 'iso-8859-1)) | 272 | (setq coding 'iso-8859-1)) |
| 274 | (setq str (encode-coding-string str coding))) | 273 | (setq str (encode-coding-string str coding))) |
| 275 | 274 | ||
| 276 | ((eq type 'COMPOUND_TEXT) | 275 | ((eq type 'COMPOUND_TEXT) |
| 277 | (if (or (not coding) | 276 | (if (or (not coding) |
| 278 | (not (eq (coding-system-type coding) 'iso-2022))) | 277 | (not (eq (coding-system-type coding) 'iso-2022))) |
| 279 | (setq coding 'compound-text-with-extensions)) | 278 | (setq coding 'compound-text-with-extensions)) |
| 280 | (setq str (encode-coding-string str coding))) | 279 | (setq str (encode-coding-string str coding))) |
| 281 | 280 | ||
| 282 | ((eq type 'C_STRING) | 281 | ((eq type 'C_STRING) |
| 283 | (setq str (string-make-unibyte str))) | 282 | (setq str (string-make-unibyte str))) |
| 284 | 283 | ||
| 285 | (t | 284 | (t |
| 286 | (error "Unknow selection type: %S" type)) | 285 | (error "Unknow selection type: %S" type)) |
| 287 | )))) | 286 | ))) |
| 288 | 287 | ||
| 289 | (setq next-selection-coding-system nil) | 288 | (setq next-selection-coding-system nil) |
| 290 | (cons type str)))) | 289 | (cons type str)))) |