diff options
| author | Lars Ingebrigtsen | 2021-11-08 12:22:56 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-11-08 12:22:56 +0100 |
| commit | 10b4cbb2fc3ff8d36bfba006bab7f4df2344465d (patch) | |
| tree | 5cc26c1a9fde494d42b2232297eecd5ee17650f9 | |
| parent | 990aad47bd1344fe7fabf8e202005cc63a4b4636 (diff) | |
| download | emacs-10b4cbb2fc3ff8d36bfba006bab7f4df2344465d.tar.gz emacs-10b4cbb2fc3ff8d36bfba006bab7f4df2344465d.zip | |
Revert "Fix charset issues when yanking non-plain-text elements"
This reverts commit 5e66c75e0b6b91b6f5d9aa46c824e8209ade8f2a.
This apparently led to problems on Windows. The issues have to
be examined first before attempting a new fix.
| -rw-r--r-- | lisp/select.el | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/lisp/select.el b/lisp/select.el index 8412405834d..3c9f961f6db 100644 --- a/lisp/select.el +++ b/lisp/select.el | |||
| @@ -303,29 +303,23 @@ addition to `STRING'; MS-Windows supports `TARGETS', which reports | |||
| 303 | the formats available in the clipboard if TYPE is `CLIPBOARD'." | 303 | the formats available in the clipboard if TYPE is `CLIPBOARD'." |
| 304 | (let ((data (gui-backend-get-selection (or type 'PRIMARY) | 304 | (let ((data (gui-backend-get-selection (or type 'PRIMARY) |
| 305 | (or data-type 'STRING)))) | 305 | (or data-type 'STRING)))) |
| 306 | (when (stringp data) | 306 | (when (and (stringp data) |
| 307 | (setq data-type (get-text-property 0 'foreign-selection data))) | ||
| 307 | (let ((coding (or next-selection-coding-system | 308 | (let ((coding (or next-selection-coding-system |
| 308 | selection-coding-system | 309 | selection-coding-system |
| 309 | (pcase data-type | 310 | (pcase data-type |
| 310 | ('UTF8_STRING 'utf-8) | 311 | ('UTF8_STRING 'utf-8) |
| 311 | ('COMPOUND_TEXT 'compound-text-with-extensions) | 312 | ('COMPOUND_TEXT 'compound-text-with-extensions) |
| 312 | ('C_STRING nil) | 313 | ('C_STRING nil) |
| 313 | ('STRING 'iso-8859-1))))) | 314 | ('STRING 'iso-8859-1) |
| 314 | (setq data | 315 | (_ (error "Unknown selection data type: %S" |
| 315 | (cond (coding (decode-coding-string data coding)) | 316 | type)))))) |
| 317 | (setq data (if coding (decode-coding-string data coding) | ||
| 318 | ;; This is for C_STRING case. | ||
| 316 | ;; We want to convert each non-ASCII byte to the | 319 | ;; We want to convert each non-ASCII byte to the |
| 317 | ;; corresponding eight-bit character, which has | 320 | ;; corresponding eight-bit character, which has |
| 318 | ;; a codepoint >= #x3FFF00. | 321 | ;; a codepoint >= #x3FFF00. |
| 319 | ((eq data-type 'C_STRING) | 322 | (string-to-multibyte data)))) |
| 320 | (string-to-multibyte data)) | ||
| 321 | ;; Guess at the charset for types like text/html | ||
| 322 | ;; -- it can be anything, and different | ||
| 323 | ;; applications use different encodings. | ||
| 324 | ((string-match-p "\\`text/" (symbol-name data-type)) | ||
| 325 | (decode-coding-string | ||
| 326 | data (car (detect-coding-string data)))) | ||
| 327 | ;; Do nothing. | ||
| 328 | (t data)))) | ||
| 329 | (setq next-selection-coding-system nil) | 323 | (setq next-selection-coding-system nil) |
| 330 | (put-text-property 0 (length data) 'foreign-selection data-type data)) | 324 | (put-text-property 0 (length data) 'foreign-selection data-type data)) |
| 331 | data)) | 325 | data)) |