changeset 20104:6128508b0c31

Include buffer.h. (selection_data_to_lisp_data): Do not perform code conversion if the default value of enable-multibyte-characters is nil. (lisp_data_to_selection_data): Likewise. Access the array `charsets' in the correct way.
author Kenichi Handa <handa@m17n.org>
date Tue, 21 Oct 1997 10:43:40 +0000
parents 7867bb9ff46a
children c017642863c2
files src/xselect.c
diffstat 1 files changed, 21 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/xselect.c	Tue Oct 21 03:35:06 1997 +0000
+++ b/src/xselect.c	Tue Oct 21 10:43:40 1997 +0000
@@ -27,6 +27,7 @@
 #include "dispextern.h"	/* frame.h seems to want this */
 #include "frame.h"	/* Need this to get the X window of selected_frame */
 #include "blockinput.h"
+#include "buffer.h"
 #include "charset.h"
 #include "coding.h"
 
@@ -1468,22 +1469,26 @@
       Lisp_Object str;
       int require_encoding = 0;
 
-      /* If TYPE is `TEXT' or `COMPOUND_TEXT', we should decode DATA
-	 to Emacs internal format because DATA may be encoded in
-	 compound text format.  In addtion, if TYPE is `STRING' and
-	 DATA contains any 8-bit Latin-1 code, we should also decode
-	 it.  */
-      if (type == dpyinfo->Xatom_TEXT || type == dpyinfo->Xatom_COMPOUND_TEXT)
-	require_encoding = 1;
-      else if (type == XA_STRING)
+      if (! NILP (buffer_defaults.enable_multibyte_characters))
 	{
-	  int i;
-	  for (i = 0; i < size; i++)
+	  /* If TYPE is `TEXT' or `COMPOUND_TEXT', we should decode
+	     DATA to Emacs internal format because DATA may be encoded
+	     in compound text format.  In addtion, if TYPE is `STRING'
+	     and DATA contains any 8-bit Latin-1 code, we should also
+	     decode it.  */
+	  if (type == dpyinfo->Xatom_TEXT
+	      || type == dpyinfo->Xatom_COMPOUND_TEXT)
+	    require_encoding = 1;
+	  else if (type == XA_STRING)
 	    {
-	      if (data[i] >= 0x80)
+	      int i;
+	      for (i = 0; i < size; i++)
 		{
-		  require_encoding = 1;
-		  break;
+		  if (data[i] >= 0x80)
+		    {
+		      require_encoding = 1;
+		      break;
+		    }
 		}
 	    }
 	}
@@ -1608,7 +1613,8 @@
       *size_ret = XSTRING (obj)->size;
       *data_ret = XSTRING (obj)->data;
       bzero (charsets, (MAX_CHARSET + 1) * sizeof (int));
-      num = ((*size_ret <= 1)	/* Check the possibility of short cut.  */
+      num = ((*size_ret <= 1	/* Check the possibility of short cut.  */
+	      || NILP (buffer_defaults.enable_multibyte_characters))
 	     ? 0
 	     : find_charset_in_str (*data_ret, *size_ret, charsets, Qnil));
 
@@ -1636,7 +1642,7 @@
 	  *size_ret = encode_coding (&coding, *data_ret, buf,
 				     *size_ret, bufsize, &dummy);
 	  *data_ret = buf;
-          if (charsets[get_charset_id(charset_latin_iso8859_1)]
+          if (charsets[charset_latin_iso8859_1]
 	      && (num == 1 || (num == 2 && charsets[CHARSET_ASCII])))
 	    {
 	      /* Ok, we can return it as `STRING'.  */