aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/coding.c b/src/coding.c
index d261418def5..a83aadfd468 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -386,7 +386,9 @@ Lisp_Object eol_mnemonic_unix, eol_mnemonic_dos, eol_mnemonic_mac;
386Lisp_Object eol_mnemonic_undecided; 386Lisp_Object eol_mnemonic_undecided;
387 387
388/* Format of end-of-line decided by system. This is CODING_EOL_LF on 388/* Format of end-of-line decided by system. This is CODING_EOL_LF on
389 Unix, CODING_EOL_CRLF on DOS/Windows, and CODING_EOL_CR on Mac. */ 389 Unix, CODING_EOL_CRLF on DOS/Windows, and CODING_EOL_CR on Mac.
390 This has an effect only for external encoding (i.e. for output to
391 file and process), not for in-buffer or Lisp string encoding. */
390int system_eol_type; 392int system_eol_type;
391 393
392#ifdef emacs 394#ifdef emacs
@@ -3920,10 +3922,7 @@ setup_coding_system (coding_system, coding)
3920 coding->type = coding_type_no_conversion; 3922 coding->type = coding_type_no_conversion;
3921 coding->category_idx = CODING_CATEGORY_IDX_BINARY; 3923 coding->category_idx = CODING_CATEGORY_IDX_BINARY;
3922 coding->common_flags = 0; 3924 coding->common_flags = 0;
3923 coding->eol_type = NILP (coding_system) ? system_eol_type : CODING_EOL_LF; 3925 coding->eol_type = CODING_EOL_UNDECIDED;
3924 if (coding->eol_type != CODING_EOL_LF)
3925 coding->common_flags
3926 |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK;
3927 coding->pre_write_conversion = coding->post_read_conversion = Qnil; 3926 coding->pre_write_conversion = coding->post_read_conversion = Qnil;
3928 return NILP (coding_system) ? 0 : -1; 3927 return NILP (coding_system) ? 0 : -1;
3929} 3928}
@@ -5000,7 +4999,7 @@ encode_coding (coding, source, destination, src_bytes, dst_bytes)
5000 coding->errors = 0; 4999 coding->errors = 0;
5001 coding->result = CODING_FINISH_NORMAL; 5000 coding->result = CODING_FINISH_NORMAL;
5002 if (coding->eol_type == CODING_EOL_UNDECIDED) 5001 if (coding->eol_type == CODING_EOL_UNDECIDED)
5003 coding->eol_type = system_eol_type; 5002 coding->eol_type = CODING_EOL_LF;
5004 5003
5005 switch (coding->type) 5004 switch (coding->type)
5006 { 5005 {
@@ -5257,8 +5256,6 @@ shrink_encoding_region (beg, end, coding, str)
5257 if (coding->type == coding_type_ccl 5256 if (coding->type == coding_type_ccl
5258 || coding->eol_type == CODING_EOL_CRLF 5257 || coding->eol_type == CODING_EOL_CRLF
5259 || coding->eol_type == CODING_EOL_CR 5258 || coding->eol_type == CODING_EOL_CR
5260 || (coding->eol_type == CODING_EOL_UNDECIDED
5261 && system_eol_type != CODING_EOL_LF)
5262 || (coding->cmp_data && coding->cmp_data->used > 0)) 5259 || (coding->cmp_data && coding->cmp_data->used > 0))
5263 { 5260 {
5264 /* We can't skip any data. */ 5261 /* We can't skip any data. */
@@ -7114,7 +7111,7 @@ code_convert_region1 (start, end, coding_system, encodep)
7114 from = XFASTINT (start); 7111 from = XFASTINT (start);
7115 to = XFASTINT (end); 7112 to = XFASTINT (end);
7116 7113
7117 if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) 7114 if (NILP (coding_system))
7118 return make_number (to - from); 7115 return make_number (to - from);
7119 7116
7120 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) 7117 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0)
@@ -7169,7 +7166,7 @@ code_convert_string1 (string, coding_system, nocopy, encodep)
7169 CHECK_STRING (string); 7166 CHECK_STRING (string);
7170 CHECK_SYMBOL (coding_system); 7167 CHECK_SYMBOL (coding_system);
7171 7168
7172 if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) 7169 if (NILP (coding_system))
7173 return (NILP (nocopy) ? Fcopy_sequence (string) : string); 7170 return (NILP (nocopy) ? Fcopy_sequence (string) : string);
7174 7171
7175 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) 7172 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0)
@@ -7228,7 +7225,7 @@ code_convert_string_norecord (string, coding_system, encodep)
7228 CHECK_STRING (string); 7225 CHECK_STRING (string);
7229 CHECK_SYMBOL (coding_system); 7226 CHECK_SYMBOL (coding_system);
7230 7227
7231 if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) 7228 if (NILP (coding_system))
7232 return string; 7229 return string;
7233 7230
7234 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) 7231 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0)