Subject: Re: bug#56682: feature/improved-locked-narrowing 9dee6df39c: Reworked locked narrowing.

From: Gregory Heytings <[email-masked]>
Date: Fri, 03 Feb 2023 00:20:40 +0000

>> Okay, if that's your decision.  IMO just going back to what the code 
>> did earlier is (very) safe, but I cannot do that without your approval.
>
> It might be safe or it might not be safe.  We will not know for sure 
> without some period of people using that.  And I'm unwilling to delay 
> the pretest by any significant time, sorry.
>

All the code that deals with long lines is carefully placed inside 
conditionals.  What I'm proposing is strictly equivalent to the following 
patch:

diff --git a/src/keyboard.c b/src/keyboard.c
index 6f0f075e54e..888a5d075b2 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1909,7 +1909,7 @@ safe_run_hooks_maybe_narrowed (Lisp_Object hook, 
struct window *w)

    specbind (Qinhibit_quit, Qt);

-  if (current_buffer->long_line_optimizations_p
+  if (0 /* current_buffer->long_line_optimizations_p */
        && long_line_locked_narrowing_region_size > 0)
      {
        ptrdiff_t begv = get_locked_narrowing_begv (PT);
diff --git a/src/xdisp.c b/src/xdisp.c
index d2c91e5847b..4ed9c858cd6 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4393,7 +4393,7 @@ handle_fontified_prop (struct it *it)

        eassert (it->end_charpos == ZV);

-      if (current_buffer->long_line_optimizations_p
+      if (0 /* current_buffer->long_line_optimizations_p */
           && long_line_locked_narrowing_region_size > 0)
         {
           ptrdiff_t begv = it->locked_narrowing_begv;

By definition, this cannot be unsafe for any buffer, except those in which 
long_line_optimizations_p is set.  So the worst that could possibly happen 
is that Emacs would hang in some buffers in which 
long_line_optimizations_p is set, which is not a regression: Emacs 28 and 
earlier would have hanged under the same conditions.

>
> Then please do.  This is one of a small number of issues whose 
> resolution delays the pretest ATM.  Which is why I pinged you several 
> times over the last month about it.
>

I know.  Unfortunately (or perhaps fortunately?) my time to hack on Emacs 
is limited.