aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2006-05-15 02:48:46 +0000
committerKenichi Handa2006-05-15 02:48:46 +0000
commitfcbcfb64503bdcc2a85d903cb27bf0c3310f5c74 (patch)
tree20b9ea6ce17afd81dfffdbcbf4d00632fd159b8f
parentb4413d9ff58177bf3ef4c8b713ecc5a656632d34 (diff)
downloademacs-fcbcfb64503bdcc2a85d903cb27bf0c3310f5c74.tar.gz
emacs-fcbcfb64503bdcc2a85d903cb27bf0c3310f5c74.zip
(system_eol_type): Sync with HEAD.
(coding_inherit_eol_type): If PARENT is nil, inherit from system_eol_type. (syms_of_coding): Initialize system_eol_type.
-rw-r--r--src/coding.c33
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. */
341Lisp_Object eol_mnemonic_undecided; 341Lisp_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. */
347static Lisp_Object system_eol_type;
348
343#ifdef emacs 349#ifdef emacs
344 350
345Lisp_Object Vcoding_system_list, Vcoding_system_alist; 351Lisp_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
5179Lisp_Object 5187Lisp_Object
5180coding_inherit_eol_type (coding_system, parent) 5188coding_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
9744char * 9763char *