GNU bug report logs -
#41692
26.3; Enhancement request, `query-replace': let user use text at point as default
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Wed, 3 Jun 2020 18:36:01 UTC
Severity: wishlist
Tags: fixed
Found in version 26.3
Fixed in version 28.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> If you want to default the FROM or TO text for `query-replace' to some
> text at point, you currently need to first isearch for it. This request
> is essentially to be able to skip doing that.
>
> As an example (only), in my own code, my version of
> `query-replace-read-from' can get the default any of these ways:
>
> * Text of nonempty active region, if option
> `search/replace-region-as-default-flag' is non-nil.
>
> * Text of secondary selection, if option
> `search/replace-2nd-sel-as-default-flag' is non-nil.
>
> * What the (function) value of option `search/replace-default-fn'
> returns, when called. This defaults to a function that grabs text at
> point. (If the function returns a list of strings, then those are the
> multiple default values.)
>
> (As with vanilla query-replace, you can also use the history lists,
> and you can enter nothing to repeat the previous query replacement
> operation.)
>
> I don't say that vanilla Emacs should do all of that. But maybe at
> least something like the third one - a function that returns a string or
> list of strings to be used as default values, and with, as its default
> value, a function that grabs some text at point.
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.
This bug report was last modified 4 years and 210 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.