# HG changeset patch # User Kenichi Handa # Date 926298241 0 # Node ID 778b3f056f7ff2d3ef1f00f99606f7b87e07cdb4 # Parent af1bca0bf79b68cac3ff34eb2262af4144ba3c5e (code_convert_region): If eol format is inconsistent, change coding->symbol to the sibling coding system of Unix like eol format. diff -r af1bca0bf79b -r 778b3f056f7f src/coding.c --- a/src/coding.c Mon May 10 00:56:54 1999 +0000 +++ b/src/coding.c Mon May 10 01:04:01 1999 +0000 @@ -4473,6 +4473,7 @@ if (! encodep && result == CODING_FINISH_INCONSISTENT_EOL) { unsigned char *pend = dst, *p = pend - inserted_byte; + Lisp_Object eol_type; /* Encode LFs back to the original eol format (CR or CRLF). */ if (coding->eol_type == CODING_EOL_CR) @@ -4486,7 +4487,7 @@ while (p < pend) if (*p++ == '\n') count++; if (src - dst < count) { - /* We don't have sufficient room for putting LFs + /* We don't have sufficient room for encoding LFs back to CRLF. We must record converted and not-yet-converted text back to the buffer content, enlarge the gap, then record them out of @@ -4519,8 +4520,14 @@ /* Suppress eol-format conversion in the further conversion. */ coding->eol_type = CODING_EOL_LF; - /* Restore the original symbol. */ - coding->symbol = saved_coding_symbol; + /* Set the coding system symbol to that for Unix-like EOL. */ + eol_type = Fget (saved_coding_symbol, Qeol_type); + if (VECTORP (eol_type) + && XVECTOR (eol_type)->size == 3 + && SYMBOLP (XVECTOR (eol_type)->contents[CODING_EOL_LF])) + coding->symbol = XVECTOR (eol_type)->contents[CODING_EOL_LF]; + else + coding->symbol = saved_coding_symbol; continue; }