summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregory Heytings <gregory@heytings.org>2022-08-20 22:55:14 +0000
committerGregory Heytings <gregory@heytings.org>2022-08-21 00:56:01 +0200
commite41e9740fb7cfb775f8f1ddff6b6a66ceafc9ab0 (patch)
treed565a19103ffd490814c37e9180b79ee6115be5c /src
parent2727af3fd448e39f79e130c42286e85a51bf7a40 (diff)
downloademacs-e41e9740fb7cfb775f8f1ddff6b6a66ceafc9ab0.tar.gz
Fix user narrowing handling.
* src/editfns.c (syms_of_editfns): New 'outermost-narrowing' internal variable. (Fwiden, Fnarrow_to_region): Set and reset the variable. (Fnarrowing_lock): Use it.
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 6987c44f986..f52db223e47 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2692,6 +2692,8 @@ in which case the the restrictions that were current when
`narrowing-lock' was called are restored. */)
(void)
{
+ Fset (Qoutermost_narrowing, Qnil);
+
if (NILP (Vnarrowing_locks))
{
if (BEG != BEGV || Z != ZV)
@@ -2708,6 +2710,8 @@ in which case the the restrictions that were current when
current_buffer->clip_changed = 1;
SET_BUF_BEGV (current_buffer, begv);
SET_BUF_ZV (current_buffer, zv);
+ if (EQ (Fcar (Fcar (Vnarrowing_locks)), Qoutermost_narrowing))
+ Fset (Qnarrowing_locks, Qnil);
}
/* Changing the buffer bounds invalidates any recorded current column. */
invalidate_current_column ();
@@ -2750,6 +2754,11 @@ restrictions that were current when `narrowing-lock' was called. */)
args_out_of_range (start, end);
}
+ Fset (Qoutermost_narrowing,
+ Fcons (Fcons (Qoutermost_narrowing,
+ Fcons (make_fixnum (BEGV), make_fixnum (ZV))),
+ Qnil));
+
if (BEGV != s || ZV != e)
current_buffer->clip_changed = 1;
@@ -2773,6 +2782,8 @@ used only within the limits of the restrictions that were current when
`narrowing-lock' was called. */)
(Lisp_Object tag)
{
+ if (NILP (Vnarrowing_locks))
+ Fset (Qnarrowing_locks, Voutermost_narrowing);
Fset (Qnarrowing_locks,
Fcons (Fcons (tag, Fcons (make_fixnum (BEGV), make_fixnum (ZV))),
Vnarrowing_locks));
@@ -4624,12 +4635,18 @@ it to be non-nil. */);
DEFSYM (Qnarrowing_locks, "narrowing-locks");
DEFVAR_LISP ("narrowing-locks", Vnarrowing_locks,
- doc: /* Internal use only.
-List of narrowing locks in the current buffer. */);
+ doc: /* List of narrowing locks in the current buffer. Internal use only. */);
Vnarrowing_locks = Qnil;
Fmake_variable_buffer_local (Qnarrowing_locks);
Funintern (Qnarrowing_locks, Qnil);
+ DEFSYM (Qoutermost_narrowing, "outermost-narrowing");
+ DEFVAR_LISP ("outermost-narrowing", Voutermost_narrowing,
+ doc: /* Outermost narrowing bounds, if any. Internal use only. */);
+ Voutermost_narrowing = Qnil;
+ Fmake_variable_buffer_local (Qoutermost_narrowing);
+ Funintern (Qoutermost_narrowing, Qnil);
+
defsubr (&Spropertize);
defsubr (&Schar_equal);
defsubr (&Sgoto_char);