Subject: bug#41692: 26.3; Enhancement request, `query-replace': let user use text at point as default

From: Drew Adams <[email-masked]>
Date: Wed, 3 Jun 2020 16:22:52 -0700 (PDT)

> query-replace-regexp already does all the above.  It provides text
> at point for first M-n, the last search string for the second M-n, etc.

The bug report was about `query-replace' (but also other,
related commands, if relevant).  

Checking with the Emacs 27 pretest, as far as I can see:

1. There's NO such defaulting for `query-replace'.  Nada.

2. `query-replace-regexp' does NOT do "all of the above".
   It doesn't use the active region.

   It doesn't use the secondary selection.

   It doesn't use a function variable does it?  I mean a
   variable whose value is a function that returns some
   particular bunch of text at point.  Something similar
   to the option `search/replace-default-fn' I mentioned.

I see, for `C-M-%', only these two defaults:

1. A word at point (e.g. `foo'),
2. A regexp that matches a symbol at point (e.g. `\_<foo\_>'.

But yes, that's better than nothing - a good start.
`query-replace' could likewise use some love.