ptrdiff_t how_much;
off_t beg_offset, end_offset;
int unprocessed;
- ptrdiff_t count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
Lisp_Object handler, val, insval, orig_filename, old_undo;
Lisp_Object p;
&& BEG == Z);
Lisp_Object old_Vdeactivate_mark = Vdeactivate_mark;
bool we_locked_file = 0;
- ptrdiff_t fd_index;
+
+ dynwind_begin ();
if (current_buffer->base_buffer && ! NILP (visit))
error ("Cannot do file visiting in an indirect buffer");
goto notfound;
}
- fd_index = SPECPDL_INDEX ();
record_unwind_protect_ptr (close_file_ptr_unwind, &fd);
/* Replacement should preserve point as it preserves markers. */
Lisp_Object workbuf;
struct buffer *buf;
- ptrdiff_t count1 = SPECPDL_INDEX ();
+ dynwind_begin ();
record_unwind_current_buffer ();
workbuf = Fget_buffer_create (build_string (" *code-converting-work*"));
coding_system = call2 (Vset_auto_coding_function,
filename, make_number (nread));
- unbind_to (count1, Qnil);
+ dynwind_end ();
/* Rewind the file for the actual read done later. */
if (lseek (fd, 0, SEEK_SET) < 0)
unsigned char *decoded;
ptrdiff_t temp;
ptrdiff_t this = 0;
- ptrdiff_t this_count = SPECPDL_INDEX ();
bool multibyte
= ! NILP (BVAR (current_buffer, enable_multibyte_characters));
Lisp_Object conversion_buffer;
struct gcpro gcpro1;
+ dynwind_begin ();
conversion_buffer = code_conversion_save (1, multibyte);
/* First read the whole file, performing code conversion into
}
inserted = 0;
- unbind_to (this_count, Qnil);
+ dynwind_end ();
goto handled;
}
/* Set point before the inserted characters. */
SET_PT_BOTH (temp, same_at_start);
- unbind_to (this_count, Qnil);
+ dynwind_end ();
goto handled;
}
care of marker adjustment. By this way, we can run Lisp
program safely before decoding the inserted text. */
Lisp_Object unwind_data;
- ptrdiff_t count1 = SPECPDL_INDEX ();
+ dynwind_begin ();
unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters),
Fcons (BVAR (current_buffer, undo_list),
if (CONSP (coding_system))
coding_system = XCAR (coding_system);
}
- unbind_to (count1, Qnil);
+ dynwind_end ();
inserted = Z_BYTE - BEG_BYTE;
}
if (inserted > 0)
{
/* Don't run point motion or modification hooks when decoding. */
- ptrdiff_t count1 = SPECPDL_INDEX ();
ptrdiff_t old_inserted = inserted;
+ dynwind_begin ();
specbind (Qinhibit_point_motion_hooks, Qt);
specbind (Qinhibit_modification_hooks, Qt);
Otherwise start with an empty undo_list. */
bset_undo_list (current_buffer, EQ (old_undo, Qt) ? Qt : Qnil);
- unbind_to (count1, Qnil);
+ dynwind_end ();
}
if (!NILP (visit)
if (NILP (val))
val = list2 (orig_filename, make_number (inserted));
- RETURN_UNGCPRO (unbind_to (count, val));
+ dynwind_end ();
+ return val;
}
\f
static Lisp_Object build_annotations (Lisp_Object, Lisp_Object);
const char *fn;
struct stat st;
struct timespec modtime;
- ptrdiff_t count = SPECPDL_INDEX ();
- ptrdiff_t count1 IF_LINT (= 0);
Lisp_Object handler;
Lisp_Object visit_file;
Lisp_Object annotations;
return val;
}
+ dynwind_begin ();
record_unwind_protect (save_restriction_restore, save_restriction_save ());
/* Special kludge to simplify auto-saving. */
report_file_errno ("Opening output file", filename, open_errno);
}
- count1 = SPECPDL_INDEX ();
+ dynwind_begin ();
record_unwind_protect_int_1 (close_file_unwind, desc, false);
}
if (emacs_close (desc) < 0)
ok = 0, save_errno = errno;
- unbind_to (count1, Qnil);
+ dynwind_end ();
}
/* Some file systems have a bug where st_mtime is not updated
= XCDR (Vwrite_region_annotation_buffers);
}
- unbind_to (count, Qnil);
+ dynwind_end ();
if (file_locked)
unlock_file (lockname);