aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGregory Heytings2023-08-16 15:58:29 +0000
committerGregory Heytings2023-08-16 16:06:34 +0000
commit9e9e11648d3d5514de85edfb69f0949a062f4716 (patch)
tree75a16ba1a1db81375829f017d51384d62f5fcf58 /src
parentd622602452cfcad01793e0f9340bdbe9034dc137 (diff)
downloademacs-9e9e11648d3d5514de85edfb69f0949a062f4716.tar.gz
emacs-9e9e11648d3d5514de85edfb69f0949a062f4716.zip
Simplify 'without-restriction'
This simplification is symmetrical to 01fb898420. * src/editfns.c: (Finternal__labeled_widen): Add a call to 'Fwiden', and rename from 'internal--unlabel-restriction'. (unwind_labeled_narrow_to_region): Use the renamed function, and remove the call to 'Fwiden'. (syms_of_editfns): Rename the symbol. * lisp/subr.el (internal--without-restriction): Use the renamed function.
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/editfns.c b/src/editfns.c
index a3e4ca12028..02fca3f5714 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2691,7 +2691,7 @@ DEFUN ("delete-and-extract-region", Fdelete_and_extract_region,
2691 labeled restriction was entered (which may be a narrowing that was 2691 labeled restriction was entered (which may be a narrowing that was
2692 set by the user and is visible on display). This alist is used 2692 set by the user and is visible on display). This alist is used
2693 internally by narrow-to-region, internal--labeled-narrow-to-region, 2693 internally by narrow-to-region, internal--labeled-narrow-to-region,
2694 widen, internal--unlabel-restriction and save-restriction. For 2694 widen, internal--labeled-widen and save-restriction. For
2695 efficiency reasons, an alist is used instead of a buffer-local 2695 efficiency reasons, an alist is used instead of a buffer-local
2696 variable: otherwise reset_outermost_restrictions, which is called 2696 variable: otherwise reset_outermost_restrictions, which is called
2697 during each redisplay cycle, would have to loop through all live 2697 during each redisplay cycle, would have to loop through all live
@@ -2867,8 +2867,7 @@ labeled_restrictions_restore (Lisp_Object buf_and_restrictions)
2867static void 2867static void
2868unwind_labeled_narrow_to_region (Lisp_Object label) 2868unwind_labeled_narrow_to_region (Lisp_Object label)
2869{ 2869{
2870 Finternal__unlabel_restriction (label); 2870 Finternal__labeled_widen (label);
2871 Fwiden ();
2872} 2871}
2873 2872
2874/* Narrow current_buffer to BEGV-ZV with a restriction labeled with 2873/* Narrow current_buffer to BEGV-ZV with a restriction labeled with
@@ -2991,7 +2990,7 @@ argument. To gain access to other portions of the buffer, use
2991 2990
2992DEFUN ("internal--labeled-narrow-to-region", Finternal__labeled_narrow_to_region, 2991DEFUN ("internal--labeled-narrow-to-region", Finternal__labeled_narrow_to_region,
2993 Sinternal__labeled_narrow_to_region, 3, 3, 0, 2992 Sinternal__labeled_narrow_to_region, 3, 3, 0,
2994 doc: /* Restrict editing in this buffer to START-END, and label the restriction with LABEL. 2993 doc: /* Restrict this buffer to START-END, and label the restriction with LABEL.
2995 2994
2996This is an internal function used by `with-restriction'. */) 2995This is an internal function used by `with-restriction'. */)
2997 (Lisp_Object start, Lisp_Object end, Lisp_Object label) 2996 (Lisp_Object start, Lisp_Object end, Lisp_Object label)
@@ -3009,9 +3008,9 @@ This is an internal function used by `with-restriction'. */)
3009 return Qnil; 3008 return Qnil;
3010} 3009}
3011 3010
3012DEFUN ("internal--unlabel-restriction", Finternal__unlabel_restriction, 3011DEFUN ("internal--labeled-widen", Finternal__labeled_widen,
3013 Sinternal__unlabel_restriction, 1, 1, 0, 3012 Sinternal__labeled_widen, 1, 1, 0,
3014 doc: /* If the current restriction is labeled with LABEL, remove its label. 3013 doc: /* Remove the current restriction if it is labeled with LABEL, and widen.
3015 3014
3016This is an internal function used by `without-restriction'. */) 3015This is an internal function used by `without-restriction'. */)
3017 (Lisp_Object label) 3016 (Lisp_Object label)
@@ -3019,6 +3018,7 @@ This is an internal function used by `without-restriction'. */)
3019 Lisp_Object buf = Fcurrent_buffer (); 3018 Lisp_Object buf = Fcurrent_buffer ();
3020 if (EQ (labeled_restrictions_peek_label (buf), label)) 3019 if (EQ (labeled_restrictions_peek_label (buf), label))
3021 labeled_restrictions_pop (buf); 3020 labeled_restrictions_pop (buf);
3021 Fwiden ();
3022 return Qnil; 3022 return Qnil;
3023} 3023}
3024 3024
@@ -4958,7 +4958,7 @@ it to be non-nil. */);
4958 defsubr (&Swiden); 4958 defsubr (&Swiden);
4959 defsubr (&Snarrow_to_region); 4959 defsubr (&Snarrow_to_region);
4960 defsubr (&Sinternal__labeled_narrow_to_region); 4960 defsubr (&Sinternal__labeled_narrow_to_region);
4961 defsubr (&Sinternal__unlabel_restriction); 4961 defsubr (&Sinternal__labeled_widen);
4962 defsubr (&Ssave_restriction); 4962 defsubr (&Ssave_restriction);
4963 defsubr (&Stranspose_regions); 4963 defsubr (&Stranspose_regions);
4964} 4964}