[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/fix-locked-narrowing a4aa32bdff 1/7: Fix 'save-restriction' for
From: |
Gregory Heytings |
Subject: |
scratch/fix-locked-narrowing a4aa32bdff 1/7: Fix 'save-restriction' for narrowing locks |
Date: |
Wed, 8 Feb 2023 20:49:28 -0500 (EST) |
branch: scratch/fix-locked-narrowing
commit a4aa32bdfff7aaf54efbacbb04b7f2b52fef92a7
Author: Gregory Heytings <gregory@heytings.org>
Commit: Gregory Heytings <gregory@heytings.org>
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.
---
lisp/emacs-lisp/bytecomp.el | 2 +-
src/bytecode.c | 2 ++
src/comp.c | 2 ++
src/editfns.c | 4 ++--
src/lisp.h | 2 ++
5 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 5df1205869..c6cda6b588 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -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)
diff --git a/src/bytecode.c b/src/bytecode.c
index 124348e5b3..8e214560f3 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -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. */
diff --git a/src/comp.c b/src/comp.c
index 10cf7962ba..0e2dfd3913 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -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
diff --git a/src/editfns.c b/src/editfns.c
index 78d2c73ecb..21e22181b8 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -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))
diff --git a/src/lisp.h b/src/lisp.h
index 1276285e2f..93197d3817 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -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);
- branch scratch/fix-locked-narrowing created (now 2956e54b1d), Gregory Heytings, 2023/02/08
- scratch/fix-locked-narrowing a4aa32bdff 1/7: Fix 'save-restriction' for narrowing locks,
Gregory Heytings <=
- scratch/fix-locked-narrowing 0d73e4aa26 4/7: Add specific symbols for narrowings, Gregory Heytings, 2023/02/08
- scratch/fix-locked-narrowing d8438e2bb4 3/7: Add 'without-narrowing' macro, Gregory Heytings, 2023/02/08
- scratch/fix-locked-narrowing 97314447e6 2/7: Make 'narrowing-lock' and 'narrowing-unlock' internal, Gregory Heytings, 2023/02/08
- scratch/fix-locked-narrowing 2956e54b1d 7/7: Add an extensive test for labeled (locked) narrowing, Gregory Heytings, 2023/02/08
- scratch/fix-locked-narrowing a6cd4553d4 5/7: Rename two long line optimizations variables, Gregory Heytings, 2023/02/08
- scratch/fix-locked-narrowing 79ce185ad1 6/7: Update the documentation about labeled (locked) narrowing, Gregory Heytings, 2023/02/08