Mercurial > emacs
changeset 18973:9f5b8d5eed29
(Finsert_file_contents): Use new macros
CODING_MAY_REQUIRE_NO_CONVERSION and
CODING_MAY_REQUIRE_NO_CONVERSION.
(Fwrite_region): Correct the logic for deciding coding system.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 25 Jul 1997 07:46:51 +0000 |
parents | 3f51d8153775 |
children | ded7c036e1ca |
files | src/fileio.c |
diffstat | 1 files changed, 15 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fileio.c Fri Jul 25 07:44:24 1997 +0000 +++ b/src/fileio.c Fri Jul 25 07:46:51 1997 +0000 @@ -3179,11 +3179,7 @@ But if we discover the need for conversion, we give up on this method and let the following if-statement handle the replace job. */ if (!NILP (replace) - && (! CODING_REQUIRE_CONVERSION (&coding) - || (coding.type == coding_type_undecided - && ! CODING_REQUIRE_EOL_CONVERSION (&coding)) - || (coding.eol_type == CODING_EOL_UNDECIDED - && ! CODING_REQUIRE_TEXT_CONVERSION (&coding)))) + && CODING_MAY_REQUIRE_NO_CONVERSION (&coding)) { int same_at_start = BEGV; int same_at_end = ZV; @@ -3218,7 +3214,8 @@ if (coding.type == coding_type_undecided) detect_coding (&coding, buffer, nread); if (coding.type != coding_type_undecided - && CODING_REQUIRE_TEXT_CONVERSION (&coding)) + && coding.type != coding_type_no_conversion + && coding.type != coding_type_emacs_mule) /* We found that the file should be decoded somehow. Let's give up here. */ { @@ -3229,7 +3226,7 @@ if (coding.eol_type == CODING_EOL_UNDECIDED) detect_eol (&coding, buffer, nread); if (coding.eol_type != CODING_EOL_UNDECIDED - && CODING_REQUIRE_EOL_CONVERSION (&coding)) + && coding.eol_type != CODING_EOL_LF) /* We found that the format of eol should be decoded. Let's give up here. */ { @@ -3304,7 +3301,7 @@ if (same_at_end > same_at_start && FETCH_BYTE (same_at_end - 1) >= 0200 && ! NILP (current_buffer->enable_multibyte_characters) - && CODING_REQUIRE_CONVERSION (&coding)) + && ! CODING_REQUIRE_NO_CONVERSION (&coding)) giveup_match_end = 1; break; } @@ -3398,7 +3395,7 @@ how_much += this; - if (CODING_REQUIRE_CONVERSION (&coding)) + if (! CODING_REQUIRE_NO_CONVERSION (&coding)) { int require, produced, consumed; @@ -3543,9 +3540,9 @@ { /* try is reserved in some compilers (Microsoft C) */ int trytry = min (total - how_much, READ_BUF_SIZE - unprocessed); - char *destination = (CODING_REQUIRE_CONVERSION (&coding) - ? read_buf + unprocessed - : (char *) (POS_ADDR (PT + inserted - 1) + 1)); + char *destination = (CODING_REQUIRE_NO_CONVERSION (&coding) + ? (char *) (POS_ADDR (PT + inserted - 1) + 1) + : read_buf + unprocessed); int this; /* Allow quitting out of the actual I/O. */ @@ -3568,7 +3565,7 @@ if (! not_regular) how_much += this; - if (CODING_REQUIRE_CONVERSION (&coding)) + if (! CODING_REQUIRE_NO_CONVERSION (&coding)) { int require, produced, consumed; @@ -3831,9 +3828,10 @@ val = Qnil; else if (!NILP (Vcoding_system_for_write)) val = Vcoding_system_for_write; - else if (NILP (current_buffer->enable_multibyte_characters) || - ! NILP (Fsymbol_value (Qbuffer_file_coding_system))) - val = Fsymbol_value (Qbuffer_file_coding_system); + else if (NILP (current_buffer->enable_multibyte_characters)) + val = (NILP (Flocal_variable_p (Qbuffer_file_coding_system)) + ? Qnil + : Fsymbol_value (Qbuffer_file_coding_system)); else { Lisp_Object args[7], coding_systems; @@ -3842,7 +3840,7 @@ args[3] = filename, args[4] = append, args[5] = visit, args[6] = lockname; coding_systems = Ffind_operation_coding_system (7, args); - val = (CONSP (coding_systems) + val = (CONSP (coding_systems) && !NILP (XCONS (coding_systems)->cdr) ? XCONS (coding_systems)->cdr : current_buffer->buffer_file_coding_system); }