changeset 89440:06b495fd070a

(kill_workbuf_unwind): New function. (Finsert_file_contents): On replacing, call make_conversion_work_buffer with correct args, and call record_unwind_protect with the first arg kill_workbuf_unwind.
author Kenichi Handa <handa@m17n.org>
date Wed, 28 May 2003 11:35:50 +0000
parents bc52ad30b028
children e8f4dff2bfc1
files src/fileio.c
diffstat 1 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c	Wed May 28 11:35:32 2003 +0000
+++ b/src/fileio.c	Wed May 28 11:35:50 2003 +0000
@@ -289,6 +289,18 @@
   Fset_marker (location, Qnil, Qnil);
   return Qnil;
 }
+
+/* Kill the working buffer for code conversion.  */
+
+static Lisp_Object
+kill_workbuf_unwind (workbuf)
+     Lisp_Object workbuf;
+{
+  if (! NILP (workbuf) && ! NILP (Fbuffer_live_p (workbuf)))
+    Fkill_buffer (workbuf);
+  return Qnil;
+}
+
 
 Lisp_Object Qexpand_file_name;
 Lisp_Object Qsubstitute_in_file_name;
@@ -4032,12 +4044,12 @@
       unsigned char *decoded;
       int temp;
       int this_count = BINDING_STACK_SIZE ();
+      int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
       Lisp_Object conversion_buffer
-	= make_conversion_work_buffer (! NILP (current_buffer
-					       ->enable_multibyte_characters));
+	= make_conversion_work_buffer (-1, multibyte);
       struct gcpro1;
 
-      record_unwind_protect (code_conversion_restore, save_excursion_save ());
+      record_unwind_protect (kill_workbuf_unwind, conversion_buffer);
 
       /* First read the whole file, performing code conversion into
 	 CONVERSION_BUFFER.  */