comparison src/coding.c @ 110845:394a9ff3e3cf

coding.c (complement_process_encoding_system): Fix previous change.
author Kenichi Handa <handa@m17n.org>
date Mon, 04 Oct 2010 10:47:51 +0900
parents b997f43af473
children c234b2db847c
comparison
equal deleted inserted replaced
110835:526c42ed21b1 110845:394a9ff3e3cf
6120 6120
6121 Lisp_Object 6121 Lisp_Object
6122 complement_process_encoding_system (coding_system) 6122 complement_process_encoding_system (coding_system)
6123 Lisp_Object coding_system; 6123 Lisp_Object coding_system;
6124 { 6124 {
6125 Lisp_Object spec, attrs, coding_type, eol_type; 6125 Lisp_Object coding_base = Qnil, eol_base = Qnil;
6126 Lisp_Object spec, attrs;
6126 6127
6127 if (NILP (coding_system)) 6128 if (NILP (coding_system))
6128 coding_system = Qundecided; 6129 coding_system = Qundecided;
6129 spec = CODING_SYSTEM_SPEC (coding_system); 6130 spec = CODING_SYSTEM_SPEC (coding_system);
6130 attrs = AREF (spec, 0); 6131 attrs = AREF (spec, 0);
6131 coding_type = CODING_ATTR_TYPE (attrs); 6132 if (! EQ (CODING_ATTR_TYPE (attrs), Qundecided))
6132 eol_type = AREF (spec, 2); 6133 coding_base = CODING_ATTR_BASE_NAME (attrs);
6133 6134 if (! VECTORP (AREF (spec, 2)))
6134 if (EQ (coding_type, Qundecided)) 6135 eol_base = coding_system;
6136
6137 if (NILP (coding_base))
6135 { 6138 {
6136 /* We must decide the text-conversion part ar first. */ 6139 /* We must decide the text-conversion part ar first. */
6137 if (CONSP (Vdefault_process_coding_system)) 6140 if (CONSP (Vdefault_process_coding_system)
6141 && ! NILP (XCDR (Vdefault_process_coding_system)))
6138 { 6142 {
6139 coding_system = XCDR (Vdefault_process_coding_system); 6143 coding_system = XCDR (Vdefault_process_coding_system);
6140 if (! NILP (coding_system)) 6144 spec = CODING_SYSTEM_SPEC (coding_system);
6141 { 6145 attrs = AREF (spec, 0);
6142 spec = CODING_SYSTEM_SPEC (coding_system); 6146 if (! EQ (CODING_ATTR_TYPE (attrs), Qundecided))
6143 attrs = AREF (spec, 0); 6147 coding_base = CODING_ATTR_BASE_NAME (attrs);
6144 coding_type = CODING_ATTR_TYPE (attrs); 6148 if (NILP (eol_base) && ! VECTORP (AREF (spec, 2)))
6145 eol_type = AREF (spec, 2); 6149 eol_base = coding_system;
6146 } 6150 }
6147 } 6151 if (NILP (coding_base))
6148 if (EQ (coding_type, Qundecided))
6149 { 6152 {
6150 coding_system = preferred_coding_system (); 6153 coding_system = preferred_coding_system ();
6151 spec = CODING_SYSTEM_SPEC (coding_system); 6154 spec = CODING_SYSTEM_SPEC (coding_system);
6152 attrs = AREF (spec, 0); 6155 attrs = AREF (spec, 0);
6153 coding_type = CODING_ATTR_TYPE (attrs); 6156 if (! EQ (CODING_ATTR_TYPE (attrs), Qundecided))
6154 eol_type = AREF (spec, 2); 6157 coding_base = CODING_ATTR_BASE_NAME (attrs);
6155 } 6158 if (NILP (eol_base) && ! VECTORP (AREF (spec, 2)))
6156 if (EQ (coding_type, Qundecided)) 6159 eol_base = coding_system;
6157 { 6160 }
6158 coding_system = Qraw_text; 6161 if (NILP (coding_base))
6159 coding_type = Qraw_text; 6162 {
6160 eol_type = Qnil; 6163 spec = CODING_SYSTEM_SPEC (Qraw_text);
6161 } 6164 attrs = AREF (spec, 0);
6162 } 6165 if (! EQ (CODING_ATTR_TYPE (attrs), Qundecided))
6163 if (NILP (eol_type) || VECTORP (eol_type)) 6166 coding_base = CODING_ATTR_BASE_NAME (attrs);
6164 { 6167 if (NILP (eol_base) && ! VECTORP (AREF (spec, 2)))
6165 /* We must decide the eol-conversion part. */ 6168 eol_base = coding_system;
6166 coding_system = coding_inherit_eol_type (coding_system, coding_system); 6169 }
6167 } 6170 }
6168 6171
6169 return coding_system; 6172 /* We must decide the eol-conversion part (if not yet done). */
6173 return coding_inherit_eol_type (coding_base, eol_base);
6170 } 6174 }
6171 6175
6172 6176
6173 /* Emacs has a mechanism to automatically detect a coding system if it 6177 /* Emacs has a mechanism to automatically detect a coding system if it
6174 is one of Emacs' internal format, ISO2022, SJIS, and BIG5. But, 6178 is one of Emacs' internal format, ISO2022, SJIS, and BIG5. But,