changeset 22614:83990ce5f58c

(Fstart_process): Check process-coding-system-alist and default-process-coding-system even in unibyte mode. (create_process): In unibyte mode, suppress character code conversion.
author Kenichi Handa <handa@m17n.org>
date Fri, 26 Jun 1998 03:29:15 +0000
parents 285822d24189
children bad8b17b0524
files src/process.c
diffstat 1 files changed, 23 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/process.c	Fri Jun 26 03:29:15 1998 +0000
+++ b/src/process.c	Fri Jun 26 03:29:15 1998 +0000
@@ -1207,24 +1207,17 @@
 		     BUF_ZV_BYTE (XBUFFER (buffer)));
 
   {
-    /* Setup coding systems for communicating with the process.  */
+    /* Decide coding systems for communicating with the process.  Here
+       we don't setup the structure coding_system nor pay attention to
+       unibyte mode.  They are done in create_process.  */
+
     /* Qt denotes we have not yet called Ffind_operation_coding_system.  */
     Lisp_Object coding_systems = Qt;
     Lisp_Object val, *args2;
     struct gcpro gcpro1;
 
-    if (!NILP (Vcoding_system_for_read))
-      val = Vcoding_system_for_read;
-    else if (!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)
-	     || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters)))
-      /* The user will normally expect EOL conversion to take place, so
-	 specify `raw-text' as the decoding system; when that is not
-	 desired, the process coding system should be set explicitly to
-	 `no-conversion'.  The encoding system will be updated to match
-	 when the EOL convention has been established, which seems
-	 reasonable.  */
-      val = Qraw_text;
-    else
+    val = Vcoding_system_for_read;
+    if (NILP (val))
       {
 	args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
 	args2[0] = Qstart_process;
@@ -1236,17 +1229,11 @@
 	  val = XCONS (coding_systems)->car;
 	else if (CONSP (Vdefault_process_coding_system))
 	  val = XCONS (Vdefault_process_coding_system)->car;
-	else
-	  val = Qnil;
       }
     XPROCESS (proc)->decode_coding_system = val;
 
-    if (!NILP (Vcoding_system_for_write))
-      val = Vcoding_system_for_write;
-    else if (!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)
-	     || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters)))
-      val = Qnil;
-    else
+    val = Vcoding_system_for_write;
+    if (NILP (val))
       {
 	if (EQ (coding_systems, Qt))
 	  {
@@ -1261,8 +1248,6 @@
 	  val = XCONS (coding_systems)->cdr;
 	else if (CONSP (Vdefault_process_coding_system))
 	  val = XCONS (Vdefault_process_coding_system)->cdr;
-	else
-	  val = Qnil;
       }
     XPROCESS (proc)->encode_coding_system = val;
   }
@@ -1356,6 +1341,7 @@
   volatile int forkin, forkout;
   volatile int pty_flag = 0;
   extern char **environ;
+  Lisp_Object buffer = XPROCESS (process)->buffer;
 
   inchannel = outchannel = -1;
 
@@ -1450,6 +1436,20 @@
   setup_coding_system (XPROCESS (process)->encode_coding_system,
 		       proc_encode_coding_system[outchannel]);
 
+  if (!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)
+      || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters)))
+    {
+      /* In unibyte mode, character code conversion should not take
+	 place but EOL conversion should.  So, setup raw-text or one
+	 of the subsidiary according to the information just setup.  */
+      if (NILP (Vcoding_system_for_read)
+	  && !NILP (XPROCESS (process)->decode_coding_system))
+	setup_raw_text_coding_system (proc_decode_coding_system[inchannel]);
+      if (NILP (Vcoding_system_for_write)
+	  && !NILP (XPROCESS (process)->encode_coding_system))
+	setup_raw_text_coding_system (proc_decode_coding_system[outchannel]);
+    }
+
   if (CODING_REQUIRE_ENCODING (proc_encode_coding_system[outchannel]))
     {
       /* Here we encode arguments by the coding system used for