[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: query-replace-interactive

From: David Kastrup
Subject: Re: query-replace-interactive
Date: 07 Jul 2004 11:35:20 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Juri Linkov <address@hidden> writes:

> Richard Stallman <address@hidden> writes:
> > I misunderstood the idea of "(default a->b)".  Now that I see what
> > it really does, I agree with you that it has lots of problems.
> >
> > Here's what I THOUGHT the idea was.
> >
> > The idea is that M-x query-replace would read just one minibuffer argument.
> > That argument would have the form FROM->TO.  After the arg is read,
> > the interactive spec would split it apart at the -> to get the FROM
> > and TO strings, and they would become the arguments in the call
> > to query-replace.
> >
> > Further, the default for this one argument would be the previous
> > argument to query-replace.  The default would be used if you type RET
> > and available to edit with M-n.
> >
> > This is radical, perhaps too radical, but it is clean and coherent.
> The original Stefan's idea was to display "(default a->b)" in the
> prompt for the from-string and to interpret empty input of the
> from-string as a request for repeating the last replacement.
> I extended this idea to what you described above, i.e. splitting the
> from-string argument in the form "FROM -> TO".  This would be more
> consistent with standard Emacs handling of default values, but it has
> one drawback: the separator should not appear in the text to replace.
> But if the string " -> " is rare enough to appear in replacement strings
> we could use it as a default separator and to allow to quote it (e.g.
> " \-\> ") if someone really wants to use it in the from-string.

You can't quote within a non-regexp replacement.  One could place the
"->" as an empty overlay in between and check its position after the
entry has been done, that way you would not be able to edit it away
and it would not be confused with -> in the text.

But this is all academic for now.  It does not belong in 21.4.  And I
also don't like getting possibly large and unrelated old replacements
displayed in the prompt unless I explicitly ask for them.  That's
what the history is for.

And there is no need for repeating a search after editing operations,
anyway, since one can then just use the "edit" keybinding in
query-replace-map for the editing.

David Kastrup, Kriemhildstr. 15, 44793 Bochum

reply via email to

[Prev in Thread] Current Thread [Next in Thread]