unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41692: 26.3; Enhancement request, `query-replace': let user use text at point as default
@ 2020-06-03 18:35 Drew Adams
  2020-06-03 22:54 ` Juri Linkov
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2020-06-03 18:35 UTC (permalink / raw)
  To: 41692

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.

In GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
 of 2019-08-29
Repository revision: 96dd0196c28bc36779584e47fffcca433c9309cd
Windowing system distributor `Microsoft Corp.', version 10.0.18362
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-01-27 18:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 18:35 bug#41692: 26.3; Enhancement request, `query-replace': let user use text at point as default Drew Adams
2020-06-03 22:54 ` Juri Linkov
2020-06-03 23:22   ` Drew Adams
2020-06-04 22:05     ` Juri Linkov
2020-06-04 23:01       ` Drew Adams
2020-06-11 22:58         ` Juri Linkov
2020-06-12  0:34           ` Drew Adams
2020-06-12  0:46             ` Drew Adams
2021-01-27 18:33               ` Juri Linkov
2021-01-27 18:55                 ` bug#41692: [External] : " Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).