summaryrefslogtreecommitdiff
path: root/src/coding.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2006-05-15 02:48:46 +0000
committerKenichi Handa <handa@m17n.org>2006-05-15 02:48:46 +0000
commitfcbcfb64503bdcc2a85d903cb27bf0c3310f5c74 (patch)
tree20b9ea6ce17afd81dfffdbcbf4d00632fd159b8f /src/coding.c
parentb4413d9ff58177bf3ef4c8b713ecc5a656632d34 (diff)
(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.
Diffstat (limited to 'src/coding.c')
-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;
decided. */
Lisp_Object eol_mnemonic_undecided;
+/* Format of end-of-line decided by system. This is Qunix on
+ Unix and Mac, Qdos on DOS/Windows.
+ This has an effect only for external encoding (i.e. for output to
+ file and process), not for in-buffer or Lisp string encoding. */
+static Lisp_Object system_eol_type;
+
#ifdef emacs
Lisp_Object Vcoding_system_list, Vcoding_system_alist;
@@ -5174,7 +5180,9 @@ raw_text_coding_system (coding_system)
/* If CODING_SYSTEM doesn't specify end-of-line format but PARENT
does, return one of the subsidiary that has the same eol-spec as
- PARENT. Otherwise, return CODING_SYSTEM. */
+ PARENT. Otherwise, return CODING_SYSTEM. If PARENT is nil,
+ inherit end-of-line format from the system's setting
+ (system_eol_type). */
Lisp_Object
coding_inherit_eol_type (coding_system, parent)
@@ -5186,15 +5194,20 @@ coding_inherit_eol_type (coding_system, parent)
coding_system = Qraw_text;
spec = CODING_SYSTEM_SPEC (coding_system);
eol_type = AREF (spec, 2);
- if (VECTORP (eol_type)
- && ! NILP (parent))
+ if (VECTORP (eol_type))
{
- Lisp_Object parent_spec;
Lisp_Object parent_eol_type;
- parent_spec
- = CODING_SYSTEM_SPEC (buffer_defaults.buffer_file_coding_system);
- parent_eol_type = AREF (parent_spec, 2);
+ if (! NILP (parent))
+ {
+ Lisp_Object parent_spec;
+
+ parent_spec
+ = CODING_SYSTEM_SPEC (buffer_defaults.buffer_file_coding_system);
+ parent_eol_type = AREF (parent_spec, 2);
+ }
+ else
+ parent_eol_type = system_eol_type;
if (EQ (parent_eol_type, Qunix))
coding_system = AREF (eol_type, 0);
else if (EQ (parent_eol_type, Qdos))
@@ -9739,6 +9752,12 @@ character.");
for (i = 0; i < coding_category_max; i++)
Fset (AREF (Vcoding_category_table, i), Qno_conversion);
}
+#if defined (MSDOS) || defined (WINDOWSNT)
+ system_eol_type = Qdos;
+#else
+ system_eol_type = Qunix;
+#endif
+ staticpro (&system_eol_type);
}
char *