Subject: bug#16433: 24.3.50; find_newline screws up in Rmail buffers

From: Eli Zaretskii <[email-masked]>
Date: Tue, 14 Jan 2014 19:36:17 +0200

> Date: Tue, 14 Jan 2014 12:06:01 -0500
> From: Richard Stallman <[email-masked]>
> CC: [email-masked]
> 
> Sorry, no, I don't have a recipe.  It was reproducible for the same
> message, at that time, but I don't know a way to make it fail again.

To reproduce it at that time, do you happen to remember what sequence
of commands was needed?

> Perhaps buffer-swap-text should simply invalidate the cache.

Could be, but just by looking at the code, it seems like
buffer-swap-text does TRT, i.e. it swaps also the pointers to the
cache.  So maybe my guess was wrong, and some other factor is at work
here.

If and when it happens again, please try to look for editing
operations that change buffer text (insert or delete characters), but
do not invalidate the cache for the region where characters were
inserted or deleted.  There should be a single call to
invalidate_region_cache for each insertion and each deletion.  This
includes insertion/deletion performed indirectly, like when decoding
the message text when it is displayed.

Thanks.