unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: isearch-query-replace-regexp and stuff
Date: Fri, 02 Jul 2004 09:55:57 +0300	[thread overview]
Message-ID: <87d63ec1py.fsf@mail.jurta.org> (raw)
In-Reply-To: <x5briz71v7.fsf@lola.goethe.zz> (David Kastrup's message of "02 Jul 2004 01:18:36 +0200")

David Kastrup <dak@gnu.org> writes:
> As far as I am able to judge from the current code that is just
> checked in, if one types M-% from within a regexp isearch or C-M-%
> from within an ordinary isearch, the history variable of the last
> irrelevant search type gets consulted.  That seems weird.

That might seem weird, but it allows users to do weird things if they
want so.  Users may want to search with C-s for a regexp in the
buffer and start C-M-% with a regexp copied literally from the search
string.

Actually, I don't know what users may want to do in these two cases
(`C-s string C-M-%' and `C-M-s regexp M-%').  There are too many
possibilities here, so I chose the most straightforward one which is
based with a simple WYSIWYG principle: what you see in the echo area
in isearch mode is what you get as the replacement string.

> I think that M-% from within a regexp isearch should probably use
> the currently matched string, and C-M-% from within an ordinary
> isearch should probably use regexp-quote of the current search
> string.
>
> I have no brilliant idea of what to do if we type M-% in a regexp
> isearch and there is no currently matched string.  Probably just beep
> and refuse, which would also be the sanest option if the regexp is
> currently incomplete.  Of course, if query-replace-interactive is
> 'initial, one might possibly just provide an empty string as initial
> value (leaving the history in peace), and if it is nil, we need not
> bother anyhow.

All this makes sense.  We could implement this for the sake of user
convenience provided that this is what most users would expect, but
often mandatory conveniences are too annoying.

> While we are at it: maybe M-s should turn an ordinary search into a
> regexp search (while regexp-quoting the current search string to make
> it fitting for a regexp search), and vice versa (by using the
> currently matched string, if any, as search string).

Do you propose a new key binding M-s or do you actually mean
modifying the existing M-r?  M-r currently toggles regular-expression
mode, but it neither quotes the regexp nor turns the search regexp
into the matched string.  We could use a prefix argument of M-r
to implement these things instead of adding a new key binding.

-- 
Juri Linkov
http://www.jurta.org/emacs/

  parent reply	other threads:[~2004-07-02  6:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-01 23:18 isearch-query-replace-regexp and stuff David Kastrup
2004-07-02  0:05 ` David Kastrup
2004-07-02 17:51   ` Richard Stallman
2004-07-02  6:55 ` Juri Linkov [this message]
2004-07-02  7:55   ` David Kastrup
2004-07-02 13:44     ` Stefan
2004-07-03  6:59     ` Juri Linkov
2004-07-03 18:20 ` Richard Stallman
2004-07-05 19:07   ` David Kastrup
2004-07-06  9:59     ` Juri Linkov
2004-07-06 11:20       ` David Kastrup
2004-07-06 16:36         ` Juri Linkov
2004-07-06 17:29           ` David Kastrup
2004-07-07  5:08             ` Juri Linkov
2004-07-07  9:29               ` David Kastrup
2004-07-07 18:29                 ` Juri Linkov
2004-07-07 19:33                   ` David Kastrup
2004-07-08 16:45                     ` Juri Linkov
2004-07-08 18:12                       ` David Kastrup
2004-07-09 20:54                         ` Juri Linkov
2004-07-08 23:17                 ` Richard Stallman
2004-07-06 22:00         ` Richard Stallman

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=87d63ec1py.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@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).