]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix 'save-restriction' for narrowing locks
authorGregory Heytings <gregory@heytings.org>
Thu, 9 Feb 2023 01:09:10 +0000 (01:09 +0000)
committerGregory Heytings <gregory@heytings.org>
Thu, 9 Feb 2023 01:44:32 +0000 (02:44 +0100)
* 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.

lisp/emacs-lisp/bytecomp.el
src/bytecode.c
src/comp.c
src/editfns.c
src/lisp.h

index 5df1205869cda185b0c13e361ed8d6e070b8e228..c6cda6b588af69ab37a28085533f6d3ce9011a8b 100644 (file)
@@ -4900,7 +4900,7 @@ binding slots have been popped."
 (defun byte-compile-save-restriction (form)
   (byte-compile-out 'byte-save-restriction 0)
   (byte-compile-body-do-effect (cdr form))
-  (byte-compile-out 'byte-unbind 1))
+  (byte-compile-out 'byte-unbind 2))
 
 (defun byte-compile-save-current-buffer (form)
   (byte-compile-out 'byte-save-current-buffer 0)
index 124348e5b358d2e6ca46136382921be39758d950..8e214560f301d8785e1a35ec2cd93b5e9c2d9942 100644 (file)
@@ -942,6 +942,8 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
        CASE (Bsave_restriction):
          record_unwind_protect (save_restriction_restore,
                                 save_restriction_save ());
+         record_unwind_protect (narrowing_locks_restore,
+                                narrowing_locks_save ());
          NEXT;
 
        CASE (Bcatch):          /* Obsolete since 25.  */
index 10cf7962ba15bdd6a1dccf04fff490f9dacc7ab3..0e2dfd3913bf43fd93894746c54f076575925111 100644 (file)
@@ -5063,6 +5063,8 @@ helper_save_restriction (void)
 {
   record_unwind_protect (save_restriction_restore,
                         save_restriction_save ());
+  record_unwind_protect (narrowing_locks_restore,
+                        narrowing_locks_save ());
 }
 
 static bool
index 78d2c73ecbff31a6af5da600e357b7a4a95edf35..21e22181b820cf1ca965bf56360e3af328759bf2 100644 (file)
@@ -2787,7 +2787,7 @@ reset_outermost_narrowings (void)
 
 /* Helper functions to save and restore the narrowing locks of the
    current buffer in Fsave_restriction.  */
-static Lisp_Object
+Lisp_Object
 narrowing_locks_save (void)
 {
   Lisp_Object buf = Fcurrent_buffer ();
@@ -2798,7 +2798,7 @@ narrowing_locks_save (void)
   return Fcons (buf, Fcopy_sequence (locks));
 }
 
-static void
+void
 narrowing_locks_restore (Lisp_Object buf_and_saved_locks)
 {
   if (NILP (buf_and_saved_locks))
index 1276285e2f2a49ac756a415eb680ef168b900bae..93197d3817677a6be8eeb9ef031747d73335ff2c 100644 (file)
@@ -4684,6 +4684,8 @@ extern void save_excursion_save (union specbinding *);
 extern void save_excursion_restore (Lisp_Object, Lisp_Object);
 extern Lisp_Object save_restriction_save (void);
 extern void save_restriction_restore (Lisp_Object);
+extern Lisp_Object narrowing_locks_save (void);
+extern void narrowing_locks_restore (Lisp_Object);
 extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, bool);
 extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t,
                                            ptrdiff_t, bool);