comparison src/fileio.c @ 89781:71b7464faec1

(Finsert_file_contents): Avoid detecting a code twice.
author Kenichi Handa <handa@m17n.org>
date Thu, 29 Jan 2004 01:27:12 +0000
parents 20a59c5d1d55
children da890d4130ce
comparison
equal deleted inserted replaced
89780:a53cb5864a40 89781:71b7464faec1
4413 else 4413 else
4414 { 4414 {
4415 /* Since we are sure that the current buffer was empty 4415 /* Since we are sure that the current buffer was empty
4416 before the insertion, we can toggle 4416 before the insertion, we can toggle
4417 enable-multibyte-characters directly here without taking 4417 enable-multibyte-characters directly here without taking
4418 care of marker adjustment and byte combining problem. By 4418 care of marker adjustment. By this way, we can run Lisp
4419 this way, we can run Lisp program safely before decoding 4419 program safely before decoding the inserted text. */
4420 the inserted text. */
4421 Lisp_Object unwind_data; 4420 Lisp_Object unwind_data;
4422 int count = SPECPDL_INDEX (); 4421 int count = SPECPDL_INDEX ();
4423 4422
4424 unwind_data = Fcons (current_buffer->enable_multibyte_characters, 4423 unwind_data = Fcons (current_buffer->enable_multibyte_characters,
4425 Fcons (current_buffer->undo_list, 4424 Fcons (current_buffer->undo_list,
4426 Fcurrent_buffer ())); 4425 Fcurrent_buffer ()));
4427 current_buffer->enable_multibyte_characters = Qnil; 4426 current_buffer->enable_multibyte_characters = Qnil;
4466 } 4465 }
4467 4466
4468 if (!NILP (visit)) 4467 if (!NILP (visit))
4469 { 4468 {
4470 /* When we visit a file by raw-text, we change the buffer to 4469 /* When we visit a file by raw-text, we change the buffer to
4471 unibyte. If we have not yet decided how to decode a text, 4470 unibyte. */
4472 decide it at first by detecting the file's encoding. */
4473 if (CODING_REQUIRE_DETECTION (&coding))
4474 {
4475 coding_system = detect_coding_system (PT_ADDR, inserted, inserted,
4476 1, 0, coding_system);
4477 setup_coding_system (coding_system, &coding);
4478 }
4479
4480 if (CODING_FOR_UNIBYTE (&coding) 4471 if (CODING_FOR_UNIBYTE (&coding)
4481 /* Can't do this if part of the buffer might be preserved. */ 4472 /* Can't do this if part of the buffer might be preserved. */
4482 && NILP (replace)) 4473 && NILP (replace))
4483 /* Visiting a file with these coding system makes the buffer 4474 /* Visiting a file with these coding system makes the buffer
4484 unibyte. */ 4475 unibyte. */