aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGregory Heytings2023-08-16 15:58:29 +0000
committerGregory Heytings2024-01-15 13:26:28 +0000
commit53b5b77010117e2f58565dacf96fddeb734b6021 (patch)
tree71fc8170c91ac6c7fc6ea9868cc2e35a5c1c9cea /src
parent5bb5590dec95e813ed120b3f09734451b4ebb18f (diff)
downloademacs-53b5b77010117e2f58565dacf96fddeb734b6021.tar.gz
emacs-53b5b77010117e2f58565dacf96fddeb734b6021.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. (cherry picked from commit 9e9e11648d3d5514de85edfb69f0949a062f4716)
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 6ddee0840c2..85f7739df07 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2684,7 +2684,7 @@ DEFUN ("delete-and-extract-region", Fdelete_and_extract_region,
2684 labeled restriction was entered (which may be a narrowing that was 2684 labeled restriction was entered (which may be a narrowing that was
2685 set by the user and is visible on display). This alist is used 2685 set by the user and is visible on display). This alist is used
2686 internally by narrow-to-region, internal--labeled-narrow-to-region, 2686 internally by narrow-to-region, internal--labeled-narrow-to-region,
2687 widen, internal--unlabel-restriction and save-restriction. For 2687 widen, internal--labeled-widen and save-restriction. For
2688 efficiency reasons, an alist is used instead of a buffer-local 2688 efficiency reasons, an alist is used instead of a buffer-local
2689 variable: otherwise reset_outermost_restrictions, which is called 2689 variable: otherwise reset_outermost_restrictions, which is called
2690 during each redisplay cycle, would have to loop through all live 2690 during each redisplay cycle, would have to loop through all live
@@ -2860,8 +2860,7 @@ labeled_restrictions_restore (Lisp_Object buf_and_restrictions)
2860static void 2860static void
2861unwind_labeled_narrow_to_region (Lisp_Object label) 2861unwind_labeled_narrow_to_region (Lisp_Object label)
2862{ 2862{
2863 Finternal__unlabel_restriction (label); 2863 Finternal__labeled_widen (label);
2864 Fwiden ();
2865} 2864}
2866 2865
2867/* Narrow current_buffer to BEGV-ZV with a restriction labeled with 2866/* Narrow current_buffer to BEGV-ZV with a restriction labeled with
@@ -2984,7 +2983,7 @@ argument. To gain access to other portions of the buffer, use
2984 2983
2985DEFUN ("internal--labeled-narrow-to-region", Finternal__labeled_narrow_to_region, 2984DEFUN ("internal--labeled-narrow-to-region", Finternal__labeled_narrow_to_region,
2986 Sinternal__labeled_narrow_to_region, 3, 3, 0, 2985 Sinternal__labeled_narrow_to_region, 3, 3, 0,
2987 doc: /* Restrict editing in this buffer to START-END, and label the restriction with LABEL. 2986 doc: /* Restrict this buffer to START-END, and label the restriction with LABEL.
2988 2987
2989This is an internal function used by `with-restriction'. */) 2988This is an internal function used by `with-restriction'. */)
2990 (Lisp_Object start, Lisp_Object end, Lisp_Object label) 2989 (Lisp_Object start, Lisp_Object end, Lisp_Object label)
@@ -3002,9 +3001,9 @@ This is an internal function used by `with-restriction'. */)
3002 return Qnil; 3001 return Qnil;
3003} 3002}
3004 3003
3005DEFUN ("internal--unlabel-restriction", Finternal__unlabel_restriction, 3004DEFUN ("internal--labeled-widen", Finternal__labeled_widen,
3006 Sinternal__unlabel_restriction, 1, 1, 0, 3005 Sinternal__labeled_widen, 1, 1, 0,
3007 doc: /* If the current restriction is labeled with LABEL, remove its label. 3006 doc: /* Remove the current restriction if it is labeled with LABEL, and widen.
3008 3007
3009This is an internal function used by `without-restriction'. */) 3008This is an internal function used by `without-restriction'. */)
3010 (Lisp_Object label) 3009 (Lisp_Object label)
@@ -3012,6 +3011,7 @@ This is an internal function used by `without-restriction'. */)
3012 Lisp_Object buf = Fcurrent_buffer (); 3011 Lisp_Object buf = Fcurrent_buffer ();
3013 if (EQ (labeled_restrictions_peek_label (buf), label)) 3012 if (EQ (labeled_restrictions_peek_label (buf), label))
3014 labeled_restrictions_pop (buf); 3013 labeled_restrictions_pop (buf);
3014 Fwiden ();
3015 return Qnil; 3015 return Qnil;
3016} 3016}
3017 3017
@@ -4951,7 +4951,7 @@ it to be non-nil. */);
4951 defsubr (&Swiden); 4951 defsubr (&Swiden);
4952 defsubr (&Snarrow_to_region); 4952 defsubr (&Snarrow_to_region);
4953 defsubr (&Sinternal__labeled_narrow_to_region); 4953 defsubr (&Sinternal__labeled_narrow_to_region);
4954 defsubr (&Sinternal__unlabel_restriction); 4954 defsubr (&Sinternal__labeled_widen);
4955 defsubr (&Ssave_restriction); 4955 defsubr (&Ssave_restriction);
4956 defsubr (&Stranspose_regions); 4956 defsubr (&Stranspose_regions);
4957} 4957}