aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/subr.el4
-rw-r--r--src/editfns.c14
2 files changed, 10 insertions, 8 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 0b397b7bebf..20722c52948 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4004,7 +4004,9 @@ are lifted.
4004(defun internal--without-restriction (body &optional label) 4004(defun internal--without-restriction (body &optional label)
4005 "Helper function for `without-restriction', which see." 4005 "Helper function for `without-restriction', which see."
4006 (save-restriction 4006 (save-restriction
4007 (if label (internal--unlabel-restriction label)) 4007 (if label
4008 (internal--labeled-widen label)
4009 (widen))
4008 (widen) 4010 (widen)
4009 (funcall body))) 4011 (funcall body)))
4010 4012
diff --git a/src/editfns.c b/src/editfns.c
index 211f1a03bee..3d9c9e2b56b 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2683,7 +2683,7 @@ DEFUN ("delete-and-extract-region", Fdelete_and_extract_region,
2683 labeled restriction was entered (which may be a narrowing that was 2683 labeled restriction was entered (which may be a narrowing that was
2684 set by the user and is visible on display). This alist is used 2684 set by the user and is visible on display). This alist is used
2685 internally by narrow-to-region, internal--labeled-narrow-to-region, 2685 internally by narrow-to-region, internal--labeled-narrow-to-region,
2686 widen, internal--unlabel-restriction and save-restriction. For 2686 widen, internal--labeled-widen and save-restriction. For
2687 efficiency reasons, an alist is used instead of a buffer-local 2687 efficiency reasons, an alist is used instead of a buffer-local
2688 variable: otherwise reset_outermost_restrictions, which is called 2688 variable: otherwise reset_outermost_restrictions, which is called
2689 during each redisplay cycle, would have to loop through all live 2689 during each redisplay cycle, would have to loop through all live
@@ -2859,8 +2859,7 @@ labeled_restrictions_restore (Lisp_Object buf_and_restrictions)
2859static void 2859static void
2860unwind_labeled_narrow_to_region (Lisp_Object label) 2860unwind_labeled_narrow_to_region (Lisp_Object label)
2861{ 2861{
2862 Finternal__unlabel_restriction (label); 2862 Finternal__labeled_widen (label);
2863 Fwiden ();
2864} 2863}
2865 2864
2866/* Narrow current_buffer to BEGV-ZV with a restriction labeled with 2865/* Narrow current_buffer to BEGV-ZV with a restriction labeled with
@@ -3001,9 +3000,9 @@ This is an internal function used by `with-restriction'. */)
3001 return Qnil; 3000 return Qnil;
3002} 3001}
3003 3002
3004DEFUN ("internal--unlabel-restriction", Finternal__unlabel_restriction, 3003DEFUN ("internal--labeled-widen", Finternal__labeled_widen,
3005 Sinternal__unlabel_restriction, 1, 1, 0, 3004 Sinternal__labeled_widen, 1, 1, 0,
3006 doc: /* If the current restriction is labeled with LABEL, remove its label. 3005 doc: /* Remove the current restriction if it is labeled with LABEL, and widen.
3007 3006
3008This is an internal function used by `without-restriction'. */) 3007This is an internal function used by `without-restriction'. */)
3009 (Lisp_Object label) 3008 (Lisp_Object label)
@@ -3011,6 +3010,7 @@ This is an internal function used by `without-restriction'. */)
3011 Lisp_Object buf = Fcurrent_buffer (); 3010 Lisp_Object buf = Fcurrent_buffer ();
3012 if (EQ (labeled_restrictions_peek_label (buf), label)) 3011 if (EQ (labeled_restrictions_peek_label (buf), label))
3013 labeled_restrictions_pop (buf); 3012 labeled_restrictions_pop (buf);
3013 Fwiden ();
3014 return Qnil; 3014 return Qnil;
3015} 3015}
3016 3016
@@ -4950,7 +4950,7 @@ it to be non-nil. */);
4950 defsubr (&Swiden); 4950 defsubr (&Swiden);
4951 defsubr (&Snarrow_to_region); 4951 defsubr (&Snarrow_to_region);
4952 defsubr (&Sinternal__labeled_narrow_to_region); 4952 defsubr (&Sinternal__labeled_narrow_to_region);
4953 defsubr (&Sinternal__unlabel_restriction); 4953 defsubr (&Sinternal__labeled_widen);
4954 defsubr (&Ssave_restriction); 4954 defsubr (&Ssave_restriction);
4955 defsubr (&Stranspose_regions); 4955 defsubr (&Stranspose_regions);
4956} 4956}