Add an optional 'lock' parameter to 'narrow-to-region'

* src/editfns.c (Fnarrow_to_region): Add the parameter to the
function, and handle it. Update docstring.
(unwind_locked_begv, unwind_locked_zv): New functions.
(Fwiden): Do nothing when restrictions are locked. Update
docstring.
(syms_of_editfns): Replace the 'inhibit-widen' symbol and variable
with a 'restrictions-locked' symbol and variable. Update docstring.

* src/xdisp.c (handle_fontified_prop): Use Fnarrow_to_region with
the new parameter.
(unwind_narrowed_zv): Remove function.

* src/process.c (Finternal_default_process_filter): Add a third
argument to Fnarrow_to_region.

* src/lread.c (readevalloop): Add a third argument to
Fnarrow_to_region.

* src/bytecode.c (exec_byte_code): Add a third argument to
Fnarrow_to_region.

* etc/NEWS (like): Mention the new parameter of 'narrow-to-region'.

* doc/lispref/positions.texi (Narrowing): Document it.
This commit is contained in:
Gregory Heytings
2022-07-28 20:37:49 +00:00
parent 2bab0f2db6
commit d3c4833d13
7 changed files with 84 additions and 36 deletions

View File

@@ -1481,7 +1481,7 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
CASE (Bnarrow_to_region):
{
Lisp_Object v1 = POP;
TOP = Fnarrow_to_region (TOP, v1);
TOP = Fnarrow_to_region (TOP, v1, Qnil);
NEXT;
}