]> git.eshelyaron.com Git - emacs.git/commitdiff
(Finsert_file_contents): Use new macros
authorKenichi Handa <handa@m17n.org>
Fri, 25 Jul 1997 07:46:51 +0000 (07:46 +0000)
committerKenichi Handa <handa@m17n.org>
Fri, 25 Jul 1997 07:46:51 +0000 (07:46 +0000)
CODING_MAY_REQUIRE_NO_CONVERSION and
CODING_MAY_REQUIRE_NO_CONVERSION.
(Fwrite_region): Correct the logic for deciding coding system.

src/fileio.c

index b8d7de46f671b25e7ee062908a0f5485fae38af6..119c6d1b200ba0f223d64f26d8444074a1879212 100644 (file)
@@ -3179,11 +3179,7 @@ This does code conversion according to the value of\n\
      But if we discover the need for conversion, we give up on this method
      and let the following if-statement handle the replace job.  */
   if (!NILP (replace)
-      && (! CODING_REQUIRE_CONVERSION (&coding)
-         || (coding.type == coding_type_undecided
-             && ! CODING_REQUIRE_EOL_CONVERSION (&coding))
-         || (coding.eol_type == CODING_EOL_UNDECIDED
-             && ! CODING_REQUIRE_TEXT_CONVERSION (&coding))))
+      && CODING_MAY_REQUIRE_NO_CONVERSION (&coding))
     {
       int same_at_start = BEGV;
       int same_at_end = ZV;
@@ -3218,7 +3214,8 @@ This does code conversion according to the value of\n\
          if (coding.type == coding_type_undecided)
            detect_coding (&coding, buffer, nread);
          if (coding.type != coding_type_undecided
-             && CODING_REQUIRE_TEXT_CONVERSION (&coding))
+             && coding.type != coding_type_no_conversion
+             && coding.type != coding_type_emacs_mule)
            /* We found that the file should be decoded somehow.
                Let's give up here.  */
            {
@@ -3229,7 +3226,7 @@ This does code conversion according to the value of\n\
          if (coding.eol_type == CODING_EOL_UNDECIDED)
            detect_eol (&coding, buffer, nread);
          if (coding.eol_type != CODING_EOL_UNDECIDED
-             && CODING_REQUIRE_EOL_CONVERSION (&coding))
+             && coding.eol_type != CODING_EOL_LF)
            /* We found that the format of eol should be decoded.
                Let's give up here.  */
            {
@@ -3304,7 +3301,7 @@ This does code conversion according to the value of\n\
              if (same_at_end > same_at_start
                  && FETCH_BYTE (same_at_end - 1) >= 0200
                  && ! NILP (current_buffer->enable_multibyte_characters)
-                 && CODING_REQUIRE_CONVERSION (&coding))
+                 && ! CODING_REQUIRE_NO_CONVERSION (&coding))
                giveup_match_end = 1;
              break;
            }
@@ -3398,7 +3395,7 @@ This does code conversion according to the value of\n\
 
          how_much += this;
 
-         if (CODING_REQUIRE_CONVERSION (&coding))
+         if (! CODING_REQUIRE_NO_CONVERSION (&coding))
            {
              int require, produced, consumed;
 
@@ -3543,9 +3540,9 @@ This does code conversion according to the value of\n\
     {
        /* try is reserved in some compilers (Microsoft C) */
       int trytry = min (total - how_much, READ_BUF_SIZE - unprocessed);
-      char *destination = (CODING_REQUIRE_CONVERSION (&coding)
-                          ? read_buf + unprocessed
-                          : (char *) (POS_ADDR (PT + inserted - 1) + 1));
+      char *destination = (CODING_REQUIRE_NO_CONVERSION (&coding)
+                          ? (char *) (POS_ADDR (PT + inserted - 1) + 1)
+                          : read_buf + unprocessed);
       int this;
 
       /* Allow quitting out of the actual I/O.  */
@@ -3568,7 +3565,7 @@ This does code conversion according to the value of\n\
       if (! not_regular)
        how_much += this;
 
-      if (CODING_REQUIRE_CONVERSION (&coding))
+      if (! CODING_REQUIRE_NO_CONVERSION (&coding))
        {
          int require, produced, consumed;
 
@@ -3831,9 +3828,10 @@ to the file, instead of any buffer contents, and END is ignored.")
       val = Qnil;
     else if (!NILP (Vcoding_system_for_write))
       val = Vcoding_system_for_write;
-    else if (NILP (current_buffer->enable_multibyte_characters) ||
-            ! NILP (Fsymbol_value (Qbuffer_file_coding_system)))
-      val = Fsymbol_value (Qbuffer_file_coding_system);
+    else if (NILP (current_buffer->enable_multibyte_characters))
+      val = (NILP (Flocal_variable_p (Qbuffer_file_coding_system))
+            ? Qnil
+            : Fsymbol_value (Qbuffer_file_coding_system));
     else
       {
        Lisp_Object args[7], coding_systems;
@@ -3842,7 +3840,7 @@ to the file, instead of any buffer contents, and END is ignored.")
          args[3] = filename, args[4] = append, args[5] = visit,
          args[6] = lockname;
        coding_systems = Ffind_operation_coding_system (7, args);
-       val = (CONSP (coding_systems)
+       val = (CONSP (coding_systems) && !NILP (XCONS (coding_systems)->cdr)
               ? XCONS (coding_systems)->cdr
               : current_buffer->buffer_file_coding_system);
       }