comparison src/fileio.c @ 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 28e6174b4119
children 0312225e013a
comparison
equal deleted inserted replaced
89439:bc52ad30b028 89440:06b495fd070a
287 { 287 {
288 Fgoto_char (location); 288 Fgoto_char (location);
289 Fset_marker (location, Qnil, Qnil); 289 Fset_marker (location, Qnil, Qnil);
290 return Qnil; 290 return Qnil;
291 } 291 }
292
293 /* Kill the working buffer for code conversion. */
294
295 static Lisp_Object
296 kill_workbuf_unwind (workbuf)
297 Lisp_Object workbuf;
298 {
299 if (! NILP (workbuf) && ! NILP (Fbuffer_live_p (workbuf)))
300 Fkill_buffer (workbuf);
301 return Qnil;
302 }
303
292 304
293 Lisp_Object Qexpand_file_name; 305 Lisp_Object Qexpand_file_name;
294 Lisp_Object Qsubstitute_in_file_name; 306 Lisp_Object Qsubstitute_in_file_name;
295 Lisp_Object Qdirectory_file_name; 307 Lisp_Object Qdirectory_file_name;
296 Lisp_Object Qfile_name_directory; 308 Lisp_Object Qfile_name_directory;
4030 int overlap; 4042 int overlap;
4031 int bufpos; 4043 int bufpos;
4032 unsigned char *decoded; 4044 unsigned char *decoded;
4033 int temp; 4045 int temp;
4034 int this_count = BINDING_STACK_SIZE (); 4046 int this_count = BINDING_STACK_SIZE ();
4047 int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
4035 Lisp_Object conversion_buffer 4048 Lisp_Object conversion_buffer
4036 = make_conversion_work_buffer (! NILP (current_buffer 4049 = make_conversion_work_buffer (-1, multibyte);
4037 ->enable_multibyte_characters));
4038 struct gcpro1; 4050 struct gcpro1;
4039 4051
4040 record_unwind_protect (code_conversion_restore, save_excursion_save ()); 4052 record_unwind_protect (kill_workbuf_unwind, conversion_buffer);
4041 4053
4042 /* First read the whole file, performing code conversion into 4054 /* First read the whole file, performing code conversion into
4043 CONVERSION_BUFFER. */ 4055 CONVERSION_BUFFER. */
4044 4056
4045 if (lseek (fd, XINT (beg), 0) < 0) 4057 if (lseek (fd, XINT (beg), 0) < 0)