emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 53e1840: Fix a recent commit in select.el


From: Eli Zaretskii
Subject: [Emacs-diffs] master 53e1840: Fix a recent commit in select.el
Date: Fri, 17 May 2019 04:02:25 -0400 (EDT)

branch: master
commit 53e18401e5c3fbbeef952f75b153d240921c1a4d
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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.
---
 lisp/select.el | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lisp/select.el b/lisp/select.el
index 3ea741d..af6bf46 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -308,15 +308,12 @@ the formats available in the clipboard if TYPE is 
`CLIPBOARD'."
                           ('STRING 'iso-8859-1)
                           (_ (error "Unknown selection data type: %S"
                                     type))))))
-        (setq data (cond
-                    (coding
-                     (decode-coding-string data coding))
-                    ;; The last two cases are only possible in the
-                    ;; C_STRING case.
-                    ((multibyte-string-p data)
-                     data)
-                    (t
-                     (encode-coding-string data 'eight-bit)))))
+        (setq data (if coding (decode-coding-string data coding)
+                     ;; This is for C_STRING case.
+                     ;; We want to convert each non-ASCII byte to the
+                     ;; corresponding eight-bit character, which has
+                     ;; a codepoint >= #x3FFF00.
+                     (string-to-multibyte data))))
       (setq next-selection-coding-system nil)
       (put-text-property 0 (length data) 'foreign-selection data-type data))
     data))
@@ -479,6 +476,9 @@ two markers or an overlay.  Otherwise, it is nil."
            (setq str (encode-coding-string str coding)))
 
           ((eq type 'C_STRING)
+            ;; If STR is unibyte (the normal case), use it; otherwise
+            ;; we assume some of the characters are eight-bit, and
+            ;; take their lower 8 bits.
            (setq str (string-make-unibyte str)))
 
           (t



reply via email to

[Prev in Thread] Current Thread [Next in Thread]