diff options
| author | Eli Zaretskii | 2019-05-17 11:01:20 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2019-05-17 11:01:20 +0300 |
| commit | 53e18401e5c3fbbeef952f75b153d240921c1a4d (patch) | |
| tree | 91e6e9d24b7ca77d956aa9e394bb75713888d80b | |
| parent | e0ea878a89f6944d8949d3df1f5d83b5ca5f48e3 (diff) | |
| download | emacs-53e18401e5c3fbbeef952f75b153d240921c1a4d.tar.gz emacs-53e18401e5c3fbbeef952f75b153d240921c1a4d.zip | |
Fix a recent commit in select.el
* lisp/select.el (gui-get-selection): Revert a recent
incorrect change. Add a comment explaining what we are trying
to do with C_STRING and why.
(xselect--encode-string): Add a comment explaining what we are
trying to do with C_STRING and why.
| -rw-r--r-- | lisp/select.el | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lisp/select.el b/lisp/select.el index 3ea741d383e..af6bf467e4a 100644 --- a/lisp/select.el +++ b/lisp/select.el | |||
| @@ -308,15 +308,12 @@ the formats available in the clipboard if TYPE is `CLIPBOARD'." | |||
| 308 | ('STRING 'iso-8859-1) | 308 | ('STRING 'iso-8859-1) |
| 309 | (_ (error "Unknown selection data type: %S" | 309 | (_ (error "Unknown selection data type: %S" |
| 310 | type)))))) | 310 | type)))))) |
| 311 | (setq data (cond | 311 | (setq data (if coding (decode-coding-string data coding) |
| 312 | (coding | 312 | ;; This is for C_STRING case. |
| 313 | (decode-coding-string data coding)) | 313 | ;; We want to convert each non-ASCII byte to the |
| 314 | ;; The last two cases are only possible in the | 314 | ;; corresponding eight-bit character, which has |
| 315 | ;; C_STRING case. | 315 | ;; a codepoint >= #x3FFF00. |
| 316 | ((multibyte-string-p data) | 316 | (string-to-multibyte data)))) |
| 317 | data) | ||
| 318 | (t | ||
| 319 | (encode-coding-string data 'eight-bit))))) | ||
| 320 | (setq next-selection-coding-system nil) | 317 | (setq next-selection-coding-system nil) |
| 321 | (put-text-property 0 (length data) 'foreign-selection data-type data)) | 318 | (put-text-property 0 (length data) 'foreign-selection data-type data)) |
| 322 | data)) | 319 | data)) |
| @@ -479,6 +476,9 @@ two markers or an overlay. Otherwise, it is nil." | |||
| 479 | (setq str (encode-coding-string str coding))) | 476 | (setq str (encode-coding-string str coding))) |
| 480 | 477 | ||
| 481 | ((eq type 'C_STRING) | 478 | ((eq type 'C_STRING) |
| 479 | ;; If STR is unibyte (the normal case), use it; otherwise | ||
| 480 | ;; we assume some of the characters are eight-bit, and | ||
| 481 | ;; take their lower 8 bits. | ||
| 482 | (setq str (string-make-unibyte str))) | 482 | (setq str (string-make-unibyte str))) |
| 483 | 483 | ||
| 484 | (t | 484 | (t |