unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: 41692@debbugs.gnu.org
Subject: bug#41692: 26.3; Enhancement request, `query-replace': let user use text at point as default
Date: Wed, 3 Jun 2020 11:35:41 -0700 (PDT)	[thread overview]
Message-ID: <3705c67a-f3a1-4667-8c3f-67b41752f355@default> (raw)

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''





             reply	other threads:[~2020-06-03 18:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03 18:35 Drew Adams [this message]
2020-06-03 22:54 ` bug#41692: 26.3; Enhancement request, `query-replace': let user use text at point as default 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3705c67a-f3a1-4667-8c3f-67b41752f355@default \
    --to=drew.adams@oracle.com \
    --cc=41692@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).