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.
This commit is contained in:
parent
0ec0a610ed
commit
a4aa32bdff
5 changed files with 9 additions and 3 deletions
|
@ -4900,7 +4900,7 @@ binding slots have been popped."
|
||||||
(defun byte-compile-save-restriction (form)
|
(defun byte-compile-save-restriction (form)
|
||||||
(byte-compile-out 'byte-save-restriction 0)
|
(byte-compile-out 'byte-save-restriction 0)
|
||||||
(byte-compile-body-do-effect (cdr form))
|
(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)
|
(defun byte-compile-save-current-buffer (form)
|
||||||
(byte-compile-out 'byte-save-current-buffer 0)
|
(byte-compile-out 'byte-save-current-buffer 0)
|
||||||
|
|
|
@ -942,6 +942,8 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
|
||||||
CASE (Bsave_restriction):
|
CASE (Bsave_restriction):
|
||||||
record_unwind_protect (save_restriction_restore,
|
record_unwind_protect (save_restriction_restore,
|
||||||
save_restriction_save ());
|
save_restriction_save ());
|
||||||
|
record_unwind_protect (narrowing_locks_restore,
|
||||||
|
narrowing_locks_save ());
|
||||||
NEXT;
|
NEXT;
|
||||||
|
|
||||||
CASE (Bcatch): /* Obsolete since 25. */
|
CASE (Bcatch): /* Obsolete since 25. */
|
||||||
|
|
|
@ -5063,6 +5063,8 @@ helper_save_restriction (void)
|
||||||
{
|
{
|
||||||
record_unwind_protect (save_restriction_restore,
|
record_unwind_protect (save_restriction_restore,
|
||||||
save_restriction_save ());
|
save_restriction_save ());
|
||||||
|
record_unwind_protect (narrowing_locks_restore,
|
||||||
|
narrowing_locks_save ());
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
|
@ -2787,7 +2787,7 @@ reset_outermost_narrowings (void)
|
||||||
|
|
||||||
/* Helper functions to save and restore the narrowing locks of the
|
/* Helper functions to save and restore the narrowing locks of the
|
||||||
current buffer in Fsave_restriction. */
|
current buffer in Fsave_restriction. */
|
||||||
static Lisp_Object
|
Lisp_Object
|
||||||
narrowing_locks_save (void)
|
narrowing_locks_save (void)
|
||||||
{
|
{
|
||||||
Lisp_Object buf = Fcurrent_buffer ();
|
Lisp_Object buf = Fcurrent_buffer ();
|
||||||
|
@ -2798,7 +2798,7 @@ narrowing_locks_save (void)
|
||||||
return Fcons (buf, Fcopy_sequence (locks));
|
return Fcons (buf, Fcopy_sequence (locks));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
narrowing_locks_restore (Lisp_Object buf_and_saved_locks)
|
narrowing_locks_restore (Lisp_Object buf_and_saved_locks)
|
||||||
{
|
{
|
||||||
if (NILP (buf_and_saved_locks))
|
if (NILP (buf_and_saved_locks))
|
||||||
|
|
|
@ -4684,6 +4684,8 @@ extern void save_excursion_save (union specbinding *);
|
||||||
extern void save_excursion_restore (Lisp_Object, Lisp_Object);
|
extern void save_excursion_restore (Lisp_Object, Lisp_Object);
|
||||||
extern Lisp_Object save_restriction_save (void);
|
extern Lisp_Object save_restriction_save (void);
|
||||||
extern void save_restriction_restore (Lisp_Object);
|
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 (ptrdiff_t, ptrdiff_t, bool);
|
||||||
extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t,
|
extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t,
|
||||||
ptrdiff_t, bool);
|
ptrdiff_t, bool);
|
||||||
|
|
Loading…
Add table
Reference in a new issue