unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Drew Adams <drew.adams@oracle.com>
Cc: 41692@debbugs.gnu.org
Subject: bug#41692: 26.3; Enhancement request, `query-replace': let user use text at point as default
Date: Thu, 04 Jun 2020 01:54:47 +0300	[thread overview]
Message-ID: <87a71jwyiw.fsf@mail.linkov.net> (raw)
In-Reply-To: <3705c67a-f3a1-4667-8c3f-67b41752f355@default> (Drew Adams's message of "Wed, 3 Jun 2020 11:35:41 -0700 (PDT)")

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





  reply	other threads:[~2020-06-03 22:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=87a71jwyiw.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=41692@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /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).