Subject: Re: bug#15841: Display bugs with cache-long-lines non-nil

From: Eli Zaretskii <[email-masked]>
Date: Sat, 09 Nov 2013 23:27:01 +0200

> Date: Sat, 09 Nov 2013 16:02:21 +0200
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked], [email-masked]
> 
> > Date: Sat, 09 Nov 2013 13:18:29 +0200
> > From: Eli Zaretskii <[email-masked]>
> > Cc: [email-masked], [email-masked]
> > 
> >  emacs -Q --eval "(setq-default cache-long-scans nil)"
> >  C-x C-f src/xdisp.c
> >  M-: (setq cache-long-scans t) RET
> >  M-x linum-mode RET
> >  M->
> > 
> > Many line numbers near the end of the buffer are not shown in the
> > margin.
> 
> This seems to be related to font-lock: turning off
> global-font-lock-mode makes the problems go away.  Manually invoking
> font-lock-fontify-buffer before turning on linum-mode also eliminates
> the problems, so it looks like JIT Font Lock is the prime suspect.

The problem was that while the "dumb loop" in find_newline was running,
memory allocation in know_region_cache could have caused relocation of
buffer text, so C pointers needed to be adjusted, but weren't.

Fixed in trunk revision 115052.