aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
authorGregory Heytings2022-08-01 19:11:01 +0000
committerGregory Heytings2022-08-01 21:11:49 +0200
commit9d8a6c82838f2f24e76a67379b02956aa668d7cf (patch)
tree4c2a1c40d39de489d90575d13efffcee13955a94 /src/editfns.c
parentc2ed2e68586098b600ff10a85e882ceb9eeb0c32 (diff)
downloademacs-9d8a6c82838f2f24e76a67379b02956aa668d7cf.tar.gz
emacs-9d8a6c82838f2f24e76a67379b02956aa668d7cf.zip
Fix the bytecode incompatibility due to the change to 'narrow-to-region'.
* src/editfns.c (narrow_to_region_internal): New function, which contains the body previously in 'Fnarrow_to_region' but accepts a third argument. (Fnarrow_to_region): Use the new function. Update the docstring. (Fwiden): Update the docstring. * src/lisp.h: Prototype of the new function. * src/xdisp.c (handle_fontified_prop): Use the new function instead of 'Fnarrow_to_region'. * src/process.c (Finternal_default_process_filter): * src/lread.c (readevalloop): Remove the third argument to 'Fnarrow_to_region'. * src/bytecode.c (exec_byte_code): * lisp/emacs-lisp/comp.el (comp-limplify-lap-inst): * lisp/emacs-lisp/bytecomp.el: Restore the statu quo ante. * etc/NEWS: Remove the entry about the new optional argument. * doc/lispref/positions.texi (Narrowing): Update the documentation.
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 79af27d24da..35b2415e8b1 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2660,9 +2660,10 @@ DEFUN ("widen", Fwiden, Swiden, 0, 0, "",
2660 doc: /* Remove restrictions (narrowing) from current buffer. 2660 doc: /* Remove restrictions (narrowing) from current buffer.
2661This allows the buffer's full text to be seen and edited. 2661This allows the buffer's full text to be seen and edited.
2662 2662
2663When called from Lisp inside a body form in which `narrow-to-region' 2663Note that, when the current buffer contains one or more lines whose
2664was called with an optional argument LOCK non-nil, this function does 2664length is above `long-line-threshold', Emacs may decide to leave, for
2665not produce any effect. */) 2665performance reasons, the accessible portion of the buffer unchanged
2666after this function is called. */)
2666 (void) 2667 (void)
2667{ 2668{
2668 if (! NILP (Vrestrictions_locked)) 2669 if (! NILP (Vrestrictions_locked))
@@ -2689,22 +2690,11 @@ unwind_locked_zv (Lisp_Object point_max)
2689 SET_BUF_ZV (current_buffer, XFIXNUM (point_max)); 2690 SET_BUF_ZV (current_buffer, XFIXNUM (point_max));
2690} 2691}
2691 2692
2692DEFUN ("narrow-to-region", Fnarrow_to_region, Snarrow_to_region, 2, 3, "r", 2693/* Internal function for Fnarrow_to_region, meant to be used with a
2693 doc: /* Restrict editing in this buffer to the current region. 2694 third argument 'true', in which case it should be followed by "specbind
2694The rest of the text becomes temporarily invisible and untouchable 2695 (Qrestrictions_locked, Qt)". */
2695but is not deleted; if you save the buffer in a file, the invisible 2696Lisp_Object
2696text is included in the file. \\[widen] makes all visible again. 2697narrow_to_region_internal (Lisp_Object start, Lisp_Object end, bool lock)
2697See also `save-restriction'.
2698
2699When calling from Lisp, pass two arguments START and END:
2700positions (integers or markers) bounding the text that should
2701remain visible.
2702
2703When called from Lisp with the optional argument LOCK non-nil,
2704calls to `widen', or to `narrow-to-region' with an optional
2705argument LOCK nil, do not produce any effect until the end of
2706the current body form. */)
2707 (Lisp_Object start, Lisp_Object end, Lisp_Object lock)
2708{ 2698{
2709 EMACS_INT s = fix_position (start), e = fix_position (end); 2699 EMACS_INT s = fix_position (start), e = fix_position (end);
2710 2700
@@ -2713,7 +2703,7 @@ the current body form. */)
2713 EMACS_INT tem = s; s = e; e = tem; 2703 EMACS_INT tem = s; s = e; e = tem;
2714 } 2704 }
2715 2705
2716 if (! NILP (lock)) 2706 if (lock)
2717 { 2707 {
2718 if (!(BEGV <= s && s <= e && e <= ZV)) 2708 if (!(BEGV <= s && s <= e && e <= ZV))
2719 args_out_of_range (start, end); 2709 args_out_of_range (start, end);
@@ -2727,8 +2717,6 @@ the current body form. */)
2727 2717
2728 SET_BUF_BEGV (current_buffer, s); 2718 SET_BUF_BEGV (current_buffer, s);
2729 SET_BUF_ZV (current_buffer, e); 2719 SET_BUF_ZV (current_buffer, e);
2730
2731 specbind (Qrestrictions_locked, Qt);
2732 } 2720 }
2733 else 2721 else
2734 { 2722 {
@@ -2754,6 +2742,26 @@ the current body form. */)
2754 return Qnil; 2742 return Qnil;
2755} 2743}
2756 2744
2745DEFUN ("narrow-to-region", Fnarrow_to_region, Snarrow_to_region, 2, 2, "r",
2746 doc: /* Restrict editing in this buffer to the current region.
2747The rest of the text becomes temporarily invisible and untouchable
2748but is not deleted; if you save the buffer in a file, the invisible
2749text is included in the file. \\[widen] makes all visible again.
2750See also `save-restriction'.
2751
2752When calling from Lisp, pass two arguments START and END:
2753positions (integers or markers) bounding the text that should
2754remain visible.
2755
2756Note that, when the current buffer contains one or more lines whose
2757length is above `long-line-threshold', Emacs may decide to leave, for
2758performance reasons, the accessible portion of the buffer unchanged
2759after this function is called. */)
2760 (Lisp_Object start, Lisp_Object end)
2761{
2762 return narrow_to_region_internal (start, end, false);
2763}
2764
2757Lisp_Object 2765Lisp_Object
2758save_restriction_save (void) 2766save_restriction_save (void)
2759{ 2767{