]> git.eshelyaron.com Git - emacs.git/commitdiff
(lisp_data_to_selection_data): If the requested type
authorEli Zaretskii <eliz@gnu.org>
Wed, 5 Jun 2002 17:38:19 +0000 (17:38 +0000)
committerEli Zaretskii <eliz@gnu.org>
Wed, 5 Jun 2002 17:38:19 +0000 (17:38 +0000)
is STRING, call string_make_unibyte to encode the selected text
as a string.

src/ChangeLog
src/xselect.c

index 941ded6b959f31c43f97ce7dcd3398123da4d802..6bef61ab14ea8dbd74a353d5d86f142b5c1ce991 100644 (file)
@@ -1,5 +1,9 @@
 2002-06-05  Eli Zaretskii  <eliz@is.elta.co.il>
 
+       * xselect.c (lisp_data_to_selection_data): If the requested type
+        is STRING, call string_make_unibyte to encode the selected text
+        as a string.
+
        * window.c (Fset_window_hscroll): Doc fix.
 
 2002-06-05  Pavel Jan\e,Bm\e(Bk  <Pavel@Janik.cz>
index 28b3338757ee5354af8a2f469974e11890902337..3e1c9d0edf9fe38da70489bb02db4f2ba2a0cd91 100644 (file)
@@ -1757,14 +1757,32 @@ lisp_data_to_selection_data (display, obj,
       /* Since we are now handling multilingual text, we must consider
         sending back compound text.  */
       int stringp;
+      extern Lisp_Object Qcompound_text;
 
       if (NILP (Vnext_selection_coding_system))
        Vnext_selection_coding_system = Vselection_coding_system;
 
       *format_ret = 8;
-      *data_ret = x_encode_text (obj, Vnext_selection_coding_system, 1,
-                                (int *) size_ret, &stringp);
-      *nofree_ret = (*data_ret == XSTRING (obj)->data);
+      /* If the requested type is STRING, we must encode the selected
+        text as a string, even if the coding system set by the user
+        is ctext or its derivatives.  */
+      if (EQ (type, QSTRING)
+         && (EQ (Vnext_selection_coding_system, Qcompound_text)
+             || EQ (Vnext_selection_coding_system,
+                    Qcompound_text_with_extensions)))
+       {
+         Lisp_Object unibyte_string;
+
+         unibyte_string = string_make_unibyte (obj);
+         *data_ret = XSTRING (unibyte_string)->data;
+         *nofree_ret = 1;
+       }
+      else
+       {
+         *data_ret = x_encode_text (obj, Vnext_selection_coding_system, 1,
+                                    (int *) size_ret, &stringp);
+         *nofree_ret = (*data_ret == XSTRING (obj)->data);
+       }
       if (NILP (type))
        type = (stringp ? QSTRING : QCOMPOUND_TEXT);
       Vlast_coding_system_used = (*nofree_ret