diff options
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/coding.c b/src/coding.c index 65d2a1eef01..debb2f27ffc 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -340,6 +340,12 @@ Lisp_Object eol_mnemonic_unix, eol_mnemonic_dos, eol_mnemonic_mac; | |||
| 340 | decided. */ | 340 | decided. */ |
| 341 | Lisp_Object eol_mnemonic_undecided; | 341 | Lisp_Object eol_mnemonic_undecided; |
| 342 | 342 | ||
| 343 | /* Format of end-of-line decided by system. This is Qunix on | ||
| 344 | Unix and Mac, Qdos on DOS/Windows. | ||
| 345 | This has an effect only for external encoding (i.e. for output to | ||
| 346 | file and process), not for in-buffer or Lisp string encoding. */ | ||
| 347 | static Lisp_Object system_eol_type; | ||
| 348 | |||
| 343 | #ifdef emacs | 349 | #ifdef emacs |
| 344 | 350 | ||
| 345 | Lisp_Object Vcoding_system_list, Vcoding_system_alist; | 351 | Lisp_Object Vcoding_system_list, Vcoding_system_alist; |
| @@ -5174,7 +5180,9 @@ raw_text_coding_system (coding_system) | |||
| 5174 | 5180 | ||
| 5175 | /* If CODING_SYSTEM doesn't specify end-of-line format but PARENT | 5181 | /* If CODING_SYSTEM doesn't specify end-of-line format but PARENT |
| 5176 | does, return one of the subsidiary that has the same eol-spec as | 5182 | does, return one of the subsidiary that has the same eol-spec as |
| 5177 | PARENT. Otherwise, return CODING_SYSTEM. */ | 5183 | PARENT. Otherwise, return CODING_SYSTEM. If PARENT is nil, |
| 5184 | inherit end-of-line format from the system's setting | ||
| 5185 | (system_eol_type). */ | ||
| 5178 | 5186 | ||
| 5179 | Lisp_Object | 5187 | Lisp_Object |
| 5180 | coding_inherit_eol_type (coding_system, parent) | 5188 | coding_inherit_eol_type (coding_system, parent) |
| @@ -5186,15 +5194,20 @@ coding_inherit_eol_type (coding_system, parent) | |||
| 5186 | coding_system = Qraw_text; | 5194 | coding_system = Qraw_text; |
| 5187 | spec = CODING_SYSTEM_SPEC (coding_system); | 5195 | spec = CODING_SYSTEM_SPEC (coding_system); |
| 5188 | eol_type = AREF (spec, 2); | 5196 | eol_type = AREF (spec, 2); |
| 5189 | if (VECTORP (eol_type) | 5197 | if (VECTORP (eol_type)) |
| 5190 | && ! NILP (parent)) | ||
| 5191 | { | 5198 | { |
| 5192 | Lisp_Object parent_spec; | ||
| 5193 | Lisp_Object parent_eol_type; | 5199 | Lisp_Object parent_eol_type; |
| 5194 | 5200 | ||
| 5195 | parent_spec | 5201 | if (! NILP (parent)) |
| 5196 | = CODING_SYSTEM_SPEC (buffer_defaults.buffer_file_coding_system); | 5202 | { |
| 5197 | parent_eol_type = AREF (parent_spec, 2); | 5203 | Lisp_Object parent_spec; |
| 5204 | |||
| 5205 | parent_spec | ||
| 5206 | = CODING_SYSTEM_SPEC (buffer_defaults.buffer_file_coding_system); | ||
| 5207 | parent_eol_type = AREF (parent_spec, 2); | ||
| 5208 | } | ||
| 5209 | else | ||
| 5210 | parent_eol_type = system_eol_type; | ||
| 5198 | if (EQ (parent_eol_type, Qunix)) | 5211 | if (EQ (parent_eol_type, Qunix)) |
| 5199 | coding_system = AREF (eol_type, 0); | 5212 | coding_system = AREF (eol_type, 0); |
| 5200 | else if (EQ (parent_eol_type, Qdos)) | 5213 | else if (EQ (parent_eol_type, Qdos)) |
| @@ -9739,6 +9752,12 @@ character."); | |||
| 9739 | for (i = 0; i < coding_category_max; i++) | 9752 | for (i = 0; i < coding_category_max; i++) |
| 9740 | Fset (AREF (Vcoding_category_table, i), Qno_conversion); | 9753 | Fset (AREF (Vcoding_category_table, i), Qno_conversion); |
| 9741 | } | 9754 | } |
| 9755 | #if defined (MSDOS) || defined (WINDOWSNT) | ||
| 9756 | system_eol_type = Qdos; | ||
| 9757 | #else | ||
| 9758 | system_eol_type = Qunix; | ||
| 9759 | #endif | ||
| 9760 | staticpro (&system_eol_type); | ||
| 9742 | } | 9761 | } |
| 9743 | 9762 | ||
| 9744 | char * | 9763 | char * |