diff options
author | Gregory Heytings <gregory@heytings.org> | 2023-03-28 23:06:55 +0000 |
---|---|---|
committer | Gregory Heytings <gregory@heytings.org> | 2023-03-29 01:12:36 +0200 |
commit | 7e26a5c774e7c71782d89abe1d4be125d8422a4b (patch) | |
tree | 7e9ab1f0c27dc2945ff89cd595a30450925e0227 | |
parent | 85ed1c9ca6b786763740766d77b1f806c2f301a1 (diff) | |
download | emacs-7e26a5c774e7c71782d89abe1d4be125d8422a4b.tar.gz |
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.
-rw-r--r-- | src/buffer.c | 1 | ||||
-rw-r--r-- | src/callproc.c | 1 | ||||
-rw-r--r-- | src/editfns.c | 7 | ||||
-rw-r--r-- | src/fileio.c | 1 | ||||
-rw-r--r-- | src/indent.c | 1 | ||||
-rw-r--r-- | src/lisp.h | 1 | ||||
-rw-r--r-- | src/lread.c | 1 | ||||
-rw-r--r-- | src/xdisp.c | 1 |
8 files changed, 14 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c index 0c740775e5b..252231357bc 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -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); diff --git a/src/callproc.c b/src/callproc.c index 5e1e1a8cc0a..6f3d4fad9be 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -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); } diff --git a/src/editfns.c b/src/editfns.c index ff711ee2a09..4c5b691eb50 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -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) { diff --git a/src/fileio.c b/src/fileio.c index f00c389a520..b50b3c6b935 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -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)) diff --git a/src/indent.c b/src/indent.c index 08d2bf5ea28..aef394dab88 100644 --- a/src/indent.c +++ b/src/indent.c @@ -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; } diff --git a/src/lisp.h b/src/lisp.h index a3d06c3b45d..9c02d975a74 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -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); diff --git a/src/lread.c b/src/lread.c index d0dc85f51c8..342d367d985 100644 --- a/src/lread.c +++ b/src/lread.c @@ -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. */ diff --git a/src/xdisp.c b/src/xdisp.c index fa411e6e8dc..c752f6712ab 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -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); |