Subject: bug#25591: 25.1; M-% offers to repeat last search, but forgets that it was a "symbol" search

From: Juri Linkov <[email-masked]>
Date: Wed, 01 Feb 2017 02:23:27 +0200

> I don't know if this is a bug, but it's disappointing and inconvenient.
>
> Start emacs with -Q, and type into the *scratch* buffer these 10 characters:
>
>     I ate this
>
> Now do C-a to move point to the beginning of the line.
>
> Now replace the symbol "i" with "u":
>
>    M-s _ i M-% u RET !
>
> So far, so good: we are looking at
>
>    U at this
>
> which is correct.
>
> Now try to repeat the replacement:
>
>    C-a M-% RET !
>
> This changes the "i" in "this" to a u, even though that "i" isn't an
> independent symbol.  I was hoping that it would do nothing.

Thanks for the feature request, or you might call it a bug
since it doesn't do what you expect.

We discussed this for isearch a while ago, where the proposal was
for ‘C-s C-s’ to reuse the search type from a previous search.
You rightfully want the same for ‘M-% RET’ to reuse a previous
replacement type.

The main problem in https://debbugs.gnu.org/22479 was to find a suitable
data structure complementary to the existing history lists to keep
search/replacement meta-data as well.