aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGregory Heytings2023-02-09 01:09:10 +0000
committerGregory Heytings2023-02-09 02:44:32 +0100
commita4aa32bdfff7aaf54efbacbb04b7f2b52fef92a7 (patch)
tree2a36555153fd494bc059132a8d78a09e6f701668 /src
parent0ec0a610ed226419269f519021cbe8fb2dde2ed5 (diff)
downloademacs-a4aa32bdfff7aaf54efbacbb04b7f2b52fef92a7.tar.gz
emacs-a4aa32bdfff7aaf54efbacbb04b7f2b52fef92a7.zip
Fix 'save-restriction' for narrowing locks
* src/editfns.c (narrowing_locks_save): (narrowing_locks_restore): Make them non-static. * src/lisp.h: Make them externally visible. * src/bytecode.c (exec_byte_code): Save and restore narrowing locks. * lisp/emacs-lisp/bytecomp.el (byte-compile-save-restriction): Increment unbinding count. * src/comp.c (helper_save_restriction): Save and restore narrowing locks.
Diffstat (limited to 'src')
-rw-r--r--src/bytecode.c2
-rw-r--r--src/comp.c2
-rw-r--r--src/editfns.c4
-rw-r--r--src/lisp.h2
4 files changed, 8 insertions, 2 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index 124348e5b35..8e214560f30 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -942,6 +942,8 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
942 CASE (Bsave_restriction): 942 CASE (Bsave_restriction):
943 record_unwind_protect (save_restriction_restore, 943 record_unwind_protect (save_restriction_restore,
944 save_restriction_save ()); 944 save_restriction_save ());
945 record_unwind_protect (narrowing_locks_restore,
946 narrowing_locks_save ());
945 NEXT; 947 NEXT;
946 948
947 CASE (Bcatch): /* Obsolete since 25. */ 949 CASE (Bcatch): /* Obsolete since 25. */
diff --git a/src/comp.c b/src/comp.c
index 10cf7962ba1..0e2dfd3913b 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -5063,6 +5063,8 @@ helper_save_restriction (void)
5063{ 5063{
5064 record_unwind_protect (save_restriction_restore, 5064 record_unwind_protect (save_restriction_restore,
5065 save_restriction_save ()); 5065 save_restriction_save ());
5066 record_unwind_protect (narrowing_locks_restore,
5067 narrowing_locks_save ());
5066} 5068}
5067 5069
5068static bool 5070static bool
diff --git a/src/editfns.c b/src/editfns.c
index 78d2c73ecbf..21e22181b82 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2787,7 +2787,7 @@ reset_outermost_narrowings (void)
2787 2787
2788/* Helper functions to save and restore the narrowing locks of the 2788/* Helper functions to save and restore the narrowing locks of the
2789 current buffer in Fsave_restriction. */ 2789 current buffer in Fsave_restriction. */
2790static Lisp_Object 2790Lisp_Object
2791narrowing_locks_save (void) 2791narrowing_locks_save (void)
2792{ 2792{
2793 Lisp_Object buf = Fcurrent_buffer (); 2793 Lisp_Object buf = Fcurrent_buffer ();
@@ -2798,7 +2798,7 @@ narrowing_locks_save (void)
2798 return Fcons (buf, Fcopy_sequence (locks)); 2798 return Fcons (buf, Fcopy_sequence (locks));
2799} 2799}
2800 2800
2801static void 2801void
2802narrowing_locks_restore (Lisp_Object buf_and_saved_locks) 2802narrowing_locks_restore (Lisp_Object buf_and_saved_locks)
2803{ 2803{
2804 if (NILP (buf_and_saved_locks)) 2804 if (NILP (buf_and_saved_locks))
diff --git a/src/lisp.h b/src/lisp.h
index 1276285e2f2..93197d38176 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4684,6 +4684,8 @@ extern void save_excursion_save (union specbinding *);
4684extern void save_excursion_restore (Lisp_Object, Lisp_Object); 4684extern void save_excursion_restore (Lisp_Object, Lisp_Object);
4685extern Lisp_Object save_restriction_save (void); 4685extern Lisp_Object save_restriction_save (void);
4686extern void save_restriction_restore (Lisp_Object); 4686extern void save_restriction_restore (Lisp_Object);
4687extern Lisp_Object narrowing_locks_save (void);
4688extern void narrowing_locks_restore (Lisp_Object);
4687extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, bool); 4689extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, bool);
4688extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, 4690extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t,
4689 ptrdiff_t, bool); 4691 ptrdiff_t, bool);