Mercurial > emacs
comparison src/coding.c @ 110847:c234b2db847c
coding.c (complement_process_encoding_system): Fix previous change.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Fri, 08 Oct 2010 09:43:16 +0900 |
| parents | 394a9ff3e3cf |
| children | bec49af30c2f b87d8337c695 |
comparison
equal
deleted
inserted
replaced
| 110846:9f6864a5076e | 110847:c234b2db847c |
|---|---|
| 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 coding_base = Qnil, eol_base = Qnil; | 6125 Lisp_Object coding_base = Qnil, eol_base = Qnil; |
| 6126 Lisp_Object spec, attrs; | 6126 Lisp_Object spec, attrs; |
| 6127 | 6127 int i; |
| 6128 if (NILP (coding_system)) | 6128 |
| 6129 coding_system = Qundecided; | 6129 for (i = 0; i < 3; i++) |
| 6130 spec = CODING_SYSTEM_SPEC (coding_system); | 6130 { |
| 6131 attrs = AREF (spec, 0); | 6131 if (i == 1) |
| 6132 if (! EQ (CODING_ATTR_TYPE (attrs), Qundecided)) | 6132 coding_system = CDR_SAFE (Vdefault_process_coding_system); |
| 6133 coding_base = CODING_ATTR_BASE_NAME (attrs); | 6133 else if (i == 2) |
| 6134 if (! VECTORP (AREF (spec, 2))) | 6134 coding_system = preferred_coding_system (); |
| 6135 eol_base = coding_system; | 6135 spec = CODING_SYSTEM_SPEC (coding_system); |
| 6136 | 6136 if (NILP (spec)) |
| 6137 if (NILP (coding_base)) | 6137 continue; |
| 6138 { | 6138 attrs = AREF (spec, 0); |
| 6139 /* We must decide the text-conversion part ar first. */ | 6139 if (NILP (coding_base) && ! EQ (CODING_ATTR_TYPE (attrs), Qundecided)) |
| 6140 if (CONSP (Vdefault_process_coding_system) | 6140 coding_base = CODING_ATTR_BASE_NAME (attrs); |
| 6141 && ! NILP (XCDR (Vdefault_process_coding_system))) | 6141 if (NILP (eol_base) && ! VECTORP (AREF (spec, 2))) |
| 6142 { | 6142 eol_base = coding_system; |
| 6143 coding_system = XCDR (Vdefault_process_coding_system); | 6143 if (! NILP (coding_base) && ! NILP (eol_base)) |
| 6144 spec = CODING_SYSTEM_SPEC (coding_system); | 6144 break; |
| 6145 attrs = AREF (spec, 0); | 6145 } |
| 6146 if (! EQ (CODING_ATTR_TYPE (attrs), Qundecided)) | 6146 |
| 6147 coding_base = CODING_ATTR_BASE_NAME (attrs); | 6147 if (i > 0) |
| 6148 if (NILP (eol_base) && ! VECTORP (AREF (spec, 2))) | 6148 /* The original CODING_SYSTEM didn't specify text-conversion or |
| 6149 eol_base = coding_system; | 6149 eol-conversion. Be sure that we return a fully complemented |
| 6150 } | 6150 coding system. */ |
| 6151 if (NILP (coding_base)) | 6151 coding_system = coding_inherit_eol_type (coding_base, eol_base); |
| 6152 { | 6152 return coding_system; |
| 6153 coding_system = preferred_coding_system (); | |
| 6154 spec = CODING_SYSTEM_SPEC (coding_system); | |
| 6155 attrs = AREF (spec, 0); | |
| 6156 if (! EQ (CODING_ATTR_TYPE (attrs), Qundecided)) | |
| 6157 coding_base = CODING_ATTR_BASE_NAME (attrs); | |
| 6158 if (NILP (eol_base) && ! VECTORP (AREF (spec, 2))) | |
| 6159 eol_base = coding_system; | |
| 6160 } | |
| 6161 if (NILP (coding_base)) | |
| 6162 { | |
| 6163 spec = CODING_SYSTEM_SPEC (Qraw_text); | |
| 6164 attrs = AREF (spec, 0); | |
| 6165 if (! EQ (CODING_ATTR_TYPE (attrs), Qundecided)) | |
| 6166 coding_base = CODING_ATTR_BASE_NAME (attrs); | |
| 6167 if (NILP (eol_base) && ! VECTORP (AREF (spec, 2))) | |
| 6168 eol_base = coding_system; | |
| 6169 } | |
| 6170 } | |
| 6171 | |
| 6172 /* We must decide the eol-conversion part (if not yet done). */ | |
| 6173 return coding_inherit_eol_type (coding_base, eol_base); | |
| 6174 } | 6153 } |
| 6175 | 6154 |
| 6176 | 6155 |
| 6177 /* Emacs has a mechanism to automatically detect a coding system if it | 6156 /* Emacs has a mechanism to automatically detect a coding system if it |
| 6178 is one of Emacs' internal format, ISO2022, SJIS, and BIG5. But, | 6157 is one of Emacs' internal format, ISO2022, SJIS, and BIG5. But, |
