# HG changeset patch # User Kenichi Handa # Date 1286156871 -32400 # Node ID 394a9ff3e3cf0c0493cda37fac666b37d7749dc7 # Parent 526c42ed21b1119bed998ee3ed9b3c23009c2236 coding.c (complement_process_encoding_system): Fix previous change. diff -r 526c42ed21b1 -r 394a9ff3e3cf src/ChangeLog --- a/src/ChangeLog Sat Oct 02 11:05:56 2010 +0900 +++ b/src/ChangeLog Mon Oct 04 10:47:51 2010 +0900 @@ -1,3 +1,8 @@ +2010-10-04 Kenichi Handa + + * coding.c (complement_process_encoding_system): Fix previous + change. + 2010-10-02 Kenichi Handa * coding.c (coding_inherit_eol_type): If parent doesn't specify diff -r 526c42ed21b1 -r 394a9ff3e3cf src/coding.c --- a/src/coding.c Sat Oct 02 11:05:56 2010 +0900 +++ b/src/coding.c Mon Oct 04 10:47:51 2010 +0900 @@ -6122,51 +6122,55 @@ complement_process_encoding_system (coding_system) Lisp_Object coding_system; { - Lisp_Object spec, attrs, coding_type, eol_type; + Lisp_Object coding_base = Qnil, eol_base = Qnil; + Lisp_Object spec, attrs; if (NILP (coding_system)) coding_system = Qundecided; spec = CODING_SYSTEM_SPEC (coding_system); attrs = AREF (spec, 0); - coding_type = CODING_ATTR_TYPE (attrs); - eol_type = AREF (spec, 2); - - if (EQ (coding_type, Qundecided)) + if (! EQ (CODING_ATTR_TYPE (attrs), Qundecided)) + coding_base = CODING_ATTR_BASE_NAME (attrs); + if (! VECTORP (AREF (spec, 2))) + eol_base = coding_system; + + if (NILP (coding_base)) { /* We must decide the text-conversion part ar first. */ - if (CONSP (Vdefault_process_coding_system)) + if (CONSP (Vdefault_process_coding_system) + && ! NILP (XCDR (Vdefault_process_coding_system))) { coding_system = XCDR (Vdefault_process_coding_system); - if (! NILP (coding_system)) - { - spec = CODING_SYSTEM_SPEC (coding_system); - attrs = AREF (spec, 0); - coding_type = CODING_ATTR_TYPE (attrs); - eol_type = AREF (spec, 2); - } - } - if (EQ (coding_type, Qundecided)) + spec = CODING_SYSTEM_SPEC (coding_system); + attrs = AREF (spec, 0); + if (! EQ (CODING_ATTR_TYPE (attrs), Qundecided)) + coding_base = CODING_ATTR_BASE_NAME (attrs); + if (NILP (eol_base) && ! VECTORP (AREF (spec, 2))) + eol_base = coding_system; + } + if (NILP (coding_base)) { coding_system = preferred_coding_system (); spec = CODING_SYSTEM_SPEC (coding_system); attrs = AREF (spec, 0); - coding_type = CODING_ATTR_TYPE (attrs); - eol_type = AREF (spec, 2); - } - if (EQ (coding_type, Qundecided)) - { - coding_system = Qraw_text; - coding_type = Qraw_text; - eol_type = Qnil; - } - } - if (NILP (eol_type) || VECTORP (eol_type)) - { - /* We must decide the eol-conversion part. */ - coding_system = coding_inherit_eol_type (coding_system, coding_system); - } - - return coding_system; + if (! EQ (CODING_ATTR_TYPE (attrs), Qundecided)) + coding_base = CODING_ATTR_BASE_NAME (attrs); + if (NILP (eol_base) && ! VECTORP (AREF (spec, 2))) + eol_base = coding_system; + } + if (NILP (coding_base)) + { + spec = CODING_SYSTEM_SPEC (Qraw_text); + attrs = AREF (spec, 0); + if (! EQ (CODING_ATTR_TYPE (attrs), Qundecided)) + coding_base = CODING_ATTR_BASE_NAME (attrs); + if (NILP (eol_base) && ! VECTORP (AREF (spec, 2))) + eol_base = coding_system; + } + } + + /* We must decide the eol-conversion part (if not yet done). */ + return coding_inherit_eol_type (coding_base, eol_base); }