Subject: bug#8174: 24.0.50; `replace-match' doesn't work right with propertized text

From: "Drew Adams" <[email-masked]>
Date: Fri, 4 Mar 2011 21:05:32 -0800

> >     (re-search-forward "tata")
> >     (let* ((file  "@@@@@")
> >     (strg  (apply #'propertize "AAAAAA"
> >     `(display ,(image-dired-get-thumbnail-image file)
> >        rear-nonsticky (display)))))
> >       (replace-match strg))))
>  
> First things first: (ignoring the lack of check that
> re-search-forward indeed succeeded)

The real code uses (when (re-search-forward... nil t)...).

> the only things allowed between the string match and
> the use of the match-data are a few Emacs primitives known to 
> leave the match-data untouched.  image-dired-get-thumbnail-image
> is not one of those primitives.

Yes, that's the problem here, so no bug.  I was not expecting to need to wrap
the `(apply... )' in `save-match-data'.  Usually I can pretty much tell when the
match data gets modified, but I guess I should have looked closer at
`image-dired-get-thumbnail-image'.