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;
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. */
{
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. */
{
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;
}
how_much += this;
- if (CODING_REQUIRE_CONVERSION (&coding))
+ if (! CODING_REQUIRE_NO_CONVERSION (&coding))
{
int require, produced, consumed;
{
/* 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. */
if (! not_regular)
how_much += this;
- if (CODING_REQUIRE_CONVERSION (&coding))
+ if (! CODING_REQUIRE_NO_CONVERSION (&coding))
{
int require, produced, consumed;
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;
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);
}