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

From: Christopher Schmidt <[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.  Emacs now loops indefinitely right during
startup.  In this case, next_change is always equal to Z and the while
loop is never exited.

        Christopher