unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dani Moncayo <dmoncayo@gmail.com>
To: Juri Linkov <juri@jurta.org>
Cc: 12526@debbugs.gnu.org
Subject: bug#12526: 24.2.50; `query-replace-interactive' not always respected
Date: Thu, 4 Oct 2012 10:39:32 +0200	[thread overview]
Message-ID: <CAH8Pv0gG3EF8ut+-7fLRH63VrL6=wOCqZS6jJ93rtk_3Wqn6Zg@mail.gmail.com> (raw)
In-Reply-To: <878vbnnmmc.fsf@mail.jurta.org>

>>>> Is that feature documented somewhere?
>>>
>>> Yes, it is documented in the Info node
>>> (info "(emacs) Special Isearch")
>>
>> Ok, but definitely the docstring of query-replace should be updated,
>> because currently it is misleading:
>>   If `query-replace-interactive' is non-nil, the last incremental search
>>   string is used as FROM-STRING--you don't have to specify it with the
>>   minibuffer.
>
> Thanks for the suggestion.  I fixed this docstring in the patch below.

Good, thanks.

>> Also, the docstring of `query-replace-interactive' should be update
>> for the same reason.
>
> Since it's easy to do `C-s C-s M-%' to replace the last search string,
> the option `query-replace-interactive' is useless now and can be
> declared obsolete.  Another reason to remove it is your suggestion below
> to use `M-% M-n' as its replacement.

As I said before, I think it is unsuitable to assume that the user
always wants to use the last search string as "from" string in
query-replace (when query-replace is invoked from Isearch).  It is
much better to let the user decide, i.e., to always prompt for the
"from" string in the minibuffer.  If the user wants to use the last
search string, it is pretty easy to type `M-n'.  At least, please,
make this behavior optional.

>> I'd like to set some user-option in my init file so that query-replace
>> never assumes nothing about the "from" string.
>
> If you don't want to use `define-key' for configuration purposes,
> we might consider using an user option, but not `query-replace-interactive'
> that is irrelevant for isearch.
>
> Such an option has been discussed but not yet implemented.
> To get an idea how this option could work, please see bug#9706
> and its related thread on emacs-devel.  With this new option,
> you will be able to define any command (not only `query-replace')
> to bypass its isearch keybinding to its original command.

I fail to see exactly how that is related to the problem discussed
here, but I think that the proper fix here is simpler (see my previous
comment).

>> BTW: I think that a much better approach would be to add the last
>> search string to the list of default arguments, so that, after an
>> Isearch, I could do `M-% M-n' if I wanted to retrieve that last search
>> string.
>
> Two weeks ago I added the last search string to `C-M-% M-n'.
> But it's still missing for `M-% M-n'.  Thank you for noticing this omission.
> This is fixed in the patch below.  This is another reason
> to declare `query-replace-interactive' obsolete because now
> there are two functional replacements for it as is documented
> in the fixed docstrings.
>
> Also I verified that "Query replace (default foo -> bar): RET"
> still works correctly and empty input redoes the last replace.

Ok, thank you for working on this.

-- 
Dani Moncayo





  reply	other threads:[~2012-10-04  8:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-27 13:03 bug#12526: 24.2.50; `query-replace-interactive' not always respected Dani Moncayo
2012-09-27 13:41 ` Stefan Monnier
2012-09-27 13:49   ` Dani Moncayo
2012-09-27 13:52     ` Dani Moncayo
2012-09-28  8:03     ` Dani Moncayo
2012-10-02 20:37     ` Juri Linkov
2012-10-03 10:00       ` Dani Moncayo
2012-10-03 23:38         ` Juri Linkov
2012-10-04  8:39           ` Dani Moncayo [this message]
2012-10-04  9:09             ` Juri Linkov
2012-10-04 11:45               ` Dani Moncayo
2012-10-04 19:30                 ` Juri Linkov
2012-10-04 14:15               ` Drew Adams
2012-10-04 19:30                 ` Juri Linkov

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='CAH8Pv0gG3EF8ut+-7fLRH63VrL6=wOCqZS6jJ93rtk_3Wqn6Zg@mail.gmail.com' \
    --to=dmoncayo@gmail.com \
    --cc=12526@debbugs.gnu.org \
    --cc=juri@jurta.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).