(Fread_coding_system): Update decl.
[bpt/emacs.git] / src / coding.c
index 7cb5200..4fae220 100644 (file)
@@ -253,6 +253,7 @@ Lisp_Object Qcoding_system, Qeol_type;
 Lisp_Object Qbuffer_file_coding_system;
 Lisp_Object Qpost_read_conversion, Qpre_write_conversion;
 Lisp_Object Qno_conversion, Qundecided;
+Lisp_Object Qcoding_system_history;
 
 extern Lisp_Object Qinsert_file_contents, Qwrite_region;
 Lisp_Object Qcall_process, Qcall_process_region, Qprocess_argument;
@@ -2384,10 +2385,12 @@ setup_coding_system (coding_system, coding)
     case 2:
       coding->type = coding_type_iso2022;
       {
-       Lisp_Object val = XVECTOR (coding_system)->contents[4];
+       Lisp_Object val;
        Lisp_Object *flags;
        int i, charset, default_reg_bits = 0;
 
+       val = XVECTOR (coding_system)->contents[4];
+
        if (!VECTORP (val) || XVECTOR (val)->size != 32)
          goto label_invalid_coding_system;
 
@@ -2690,9 +2693,10 @@ detect_coding_mask (src, src_bytes)
       /* C is an ISO2022 specific control code of C0.  */
       mask = detect_coding_iso2022 (src, src_end);
       src++;
-      if (mask == CODING_CATEGORY_MASK_ANY)
+      if (mask == 0)
        /* No valid ISO2022 code follows C.  Try again.  */
        goto label_loop_detect_coding;
+      mask |= CODING_CATEGORY_MASK_RAW_TEXT;
     }
   else if (c < 0xA0)
     {
@@ -2850,7 +2854,7 @@ detect_eol (coding, src, src_bytes)
        }
       /* Else, let's decode only text code anyway.  */
 #endif /* 0 */
-      eol_type == CODING_EOL_LF;
+      eol_type = CODING_EOL_LF;
     }
 
   coding_system = coding->symbol;
@@ -3113,8 +3117,9 @@ DEFUN ("read-coding-system", Fread_coding_system, Sread_coding_system, 1, 1, 0,
   (prompt)
      Lisp_Object prompt;
 {
-  Lisp_Object val = Fcompleting_read (prompt, Vobarray, Qcoding_system_p,
-                                     Qt, Qnil, Qnil, Qnil, Qnil);
+  Lisp_Object val;
+  val = Fcompleting_read (prompt, Vobarray, Qcoding_system_p,
+                         Qt, Qnil, Qcoding_system_history, Qnil, Qnil);
   return (XSTRING (val)->size == 0 ? Qnil : Fintern (val, Qnil));
 }
 
@@ -3160,7 +3165,8 @@ If only ASCII characters are found, it returns `undecided'\n\
       if (eol_type != CODING_EOL_UNDECIDED
          && eol_type != CODING_EOL_INCONSISTENT)
        {
-         Lisp_Object val2 = Fget (Qundecided, Qeol_type);
+         Lisp_Object val2;
+         val2 = Fget (Qundecided, Qeol_type);
          if (VECTORP (val2))
            val = XVECTOR (val2)->contents[eol_type];
        }
@@ -3205,7 +3211,8 @@ If only ASCII characters are found, it returns `undecided'\n\
            val = Fcons (XCONS (val2)->car, val);
          else
            {
-             Lisp_Object val3 = Fget (XCONS (val2)->car, Qeol_type);
+             Lisp_Object val3;
+             val3 = Fget (XCONS (val2)->car, Qeol_type);
              if (VECTORP (val3))
                val = Fcons (XVECTOR (val3)->contents[eol_type], val);
              else
@@ -3767,7 +3774,8 @@ which is a list of all the arguments given to this function.")
 
   for (; CONSP (chain); chain = XCONS (chain)->cdr)
     {
-      Lisp_Object elt = XCONS (chain)->car;
+      Lisp_Object elt;
+      elt = XCONS (chain)->car;
 
       if (CONSP (elt)
          && ((STRINGP (target)
@@ -3856,6 +3864,10 @@ syms_of_coding ()
   Qtarget_idx = intern ("target-idx");
   staticpro (&Qtarget_idx);
 
+  Qcoding_system_history = intern ("coding-system-history");
+  staticpro (&Qcoding_system_history);
+  Fset (Qcoding_system_history, Qnil);
+
   /* Target FILENAME is the first argument.  */
   Fput (Qinsert_file_contents, Qtarget_idx, make_number (0));
   /* Target FILENAME is the third argument.  */
@@ -4097,7 +4109,7 @@ the cdr part is used for encoding a text to be sent to a process.");
     "Table of extra Latin codes in the range 128..159 (inclusive).\n\
 This is a vector of length 256.\n\
 If Nth element is non-nil, the existence of code N in a file\n\
-(or output of subprocess) doesn't prevent it to be detected as\n\
+\(or output of subprocess) doesn't prevent it to be detected as\n\
 a coding system of ISO 2022 variant which has a flag\n\
 `accept-latin-extra-code' t (e.g. iso-latin-1) on reading a file\n\
 or reading output of a subprocess.\n\