From 2ba48777807b48614ae7be30f7a6e0f5809b909d Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 14 Mar 2003 05:13:52 +0000 Subject: [PATCH] (Finsert_file_contents): On replacing, before decoding the file into the work buffer, set point of the work buffer to the end. --- src/fileio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/fileio.c b/src/fileio.c index 8c4e651455a..674b954e401 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4035,6 +4035,7 @@ actually used. */) Lisp_Object conversion_buffer = make_conversion_work_buffer (! NILP (current_buffer ->enable_multibyte_characters)); + struct gcpro1; record_unwind_protect (code_conversion_restore, save_excursion_save ()); @@ -4052,6 +4053,7 @@ actually used. */) inserted = 0; /* Bytes put into CONVERSION_BUFFER so far. */ unprocessed = 0; /* Bytes not processed in previous loop. */ + GCPRO1 (conversion_buffer); while (how_much < total) { /* We read one bunch by one (READ_BUF_SIZE bytes) to allow @@ -4075,13 +4077,15 @@ actually used. */) how_much += this; + BUF_SET_PT (XBUFFER (conversion_buffer), + BUF_Z (XBUFFER (conversion_buffer))); decode_coding_c_string (&coding, read_buf, unprocessed + this, conversion_buffer); unprocessed = coding.carryover_bytes; if (coding.carryover_bytes > 0) bcopy (coding.carryover, read_buf, unprocessed); } - + UNGCPRO; emacs_close (fd); /* At this point, HOW_MUCH should equal TOTAL, or should be <= 0 -- 2.39.5