Remove labeled restrictions before calling Fwiden
* src/editfns.c (labeled_restrictions_remove_in_current_buffer): New function. * src/lisp.h: Make it externally visible. * src/xdisp.c (display_count_lines_logically): * src/lread.c (readevalloop): * src/indent.c (line_number_display_width): * src/fileio.c (write_region): * src/callproc.c (Fcall_process_region): * src/buffer.c (Ferase_buffer): Use it.
This commit is contained in:
parent
85ed1c9ca6
commit
7e26a5c774
8 changed files with 14 additions and 0 deletions
|
@ -2386,6 +2386,7 @@ Any narrowing restriction in effect (see `narrow-to-region') is removed,
|
|||
so the buffer is truly empty after this. */)
|
||||
(void)
|
||||
{
|
||||
labeled_restrictions_remove_in_current_buffer ();
|
||||
Fwiden ();
|
||||
|
||||
del_range (BEG, Z);
|
||||
|
|
|
@ -1113,6 +1113,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
|
|||
{
|
||||
/* No need to save restrictions since we delete everything
|
||||
anyway. */
|
||||
labeled_restrictions_remove_in_current_buffer ();
|
||||
Fwiden ();
|
||||
del_range (BEG, Z);
|
||||
}
|
||||
|
|
|
@ -2756,6 +2756,13 @@ labeled_restrictions_pop (Lisp_Object buf)
|
|||
XSETCDR (restrictions, list1 (XCDR (XCAR (XCDR (restrictions)))));
|
||||
}
|
||||
|
||||
/* Unconditionally remove all labeled restrictions in current_buffer. */
|
||||
void
|
||||
labeled_restrictions_remove_in_current_buffer (void)
|
||||
{
|
||||
labeled_restrictions_remove (Fcurrent_buffer ());
|
||||
}
|
||||
|
||||
static void
|
||||
unwind_reset_outermost_restriction (Lisp_Object buf)
|
||||
{
|
||||
|
|
|
@ -5269,6 +5269,7 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
|
|||
}
|
||||
|
||||
record_unwind_protect (save_restriction_restore, save_restriction_save ());
|
||||
labeled_restrictions_remove_in_current_buffer ();
|
||||
|
||||
/* Special kludge to simplify auto-saving. */
|
||||
if (NILP (start))
|
||||
|
|
|
@ -2065,6 +2065,7 @@ line_number_display_width (struct window *w, int *width, int *pixel_width)
|
|||
{
|
||||
record_unwind_protect (save_restriction_restore,
|
||||
save_restriction_save ());
|
||||
labeled_restrictions_remove_in_current_buffer ();
|
||||
Fwiden ();
|
||||
saved_restriction = true;
|
||||
}
|
||||
|
|
|
@ -4689,6 +4689,7 @@ extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t,
|
|||
ptrdiff_t, bool);
|
||||
extern void labeled_narrow_to_region (Lisp_Object, Lisp_Object, Lisp_Object);
|
||||
extern void reset_outermost_restrictions (void);
|
||||
extern void labeled_restrictions_remove_in_current_buffer (void);
|
||||
extern void init_editfns (void);
|
||||
extern void syms_of_editfns (void);
|
||||
|
||||
|
|
|
@ -2255,6 +2255,7 @@ readevalloop (Lisp_Object readcharfun,
|
|||
record_unwind_protect_excursion ();
|
||||
/* Save ZV in it. */
|
||||
record_unwind_protect (save_restriction_restore, save_restriction_save ());
|
||||
labeled_restrictions_remove_in_current_buffer ();
|
||||
/* Those get unbound after we read one expression. */
|
||||
|
||||
/* Set point and ZV around stuff to be read. */
|
||||
|
|
|
@ -24199,6 +24199,7 @@ display_count_lines_logically (ptrdiff_t start_byte, ptrdiff_t limit_byte,
|
|||
ptrdiff_t val;
|
||||
specpdl_ref pdl_count = SPECPDL_INDEX ();
|
||||
record_unwind_protect (save_restriction_restore, save_restriction_save ());
|
||||
labeled_restrictions_remove_in_current_buffer ();
|
||||
Fwiden ();
|
||||
val = display_count_lines (start_byte, limit_byte, count, byte_pos_ptr);
|
||||
unbind_to (pdl_count, Qnil);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue