Subject: Re: bug#12196: 24.1.50; setting cache-long-line-scans to non-nil freezes Emacs

From: Eli Zaretskii <[email-masked]>
Date: Mon, 10 Sep 2012 20:10:33 +0300

> From: Christopher Schmidt <[email-masked]>
> Cc: [email-masked]
> Date: Mon, 10 Sep 2012 14:19:00 +0100 (BST)
> 
> Eli Zaretskii <[email-masked]> writes:
> > Thanks.  Does the patch below help?
> > === modified file 'src/search.c'
> > --- src/search.c	2012-09-04 17:34:54 +0000
> > +++ src/search.c	2012-09-10 11:07:13 +0000
> > @@ -681,10 +681,11 @@ scan_buffer (register int target, ptrdif
> >             to see where we can avoid some scanning.  */
> >          if (target == '\n' && newline_cache)
> >            {
> > -            ptrdiff_t next_change;
> > +            ptrdiff_t next_change = 0;
> >              immediate_quit = 0;
> >              while (region_cache_forward
> > -                   (current_buffer, newline_cache, start_byte, &next_change))
> > +                   (current_buffer, newline_cache, start_byte, &next_change)
> > +                || next_change == Z)
> >                start_byte = next_change;
> >              immediate_quit = allow_quit;
> 
> Unfortunately it does not.

How about the one below?

Once again, a reproducible recipe with buffer text that causes the
infloop would help immensely, TIA.

=== modified file 'src/search.c'
--- src/search.c	2012-09-04 17:34:54 +0000
+++ src/search.c	2012-09-10 17:06:46 +0000
@@ -666,7 +666,7 @@ scan_buffer (register int target, ptrdif
   immediate_quit = allow_quit;
 
   if (count > 0)
-    while (start != end)
+    while (start < end)
       {
         /* Our innermost scanning loop is very simple; it doesn't know
            about gaps, buffer ends, or the newline cache.  ceiling is