[Top][All Lists]

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

Re: query-replace-interactive

From: Miles Bader
Subject: Re: query-replace-interactive
Date: Wed, 07 Jul 2004 14:42:27 +0900

Juri Linkov <address@hidden> writes:
> 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

I think that it could be extremely confusing for the user when problems
_did_ crop up (which they will).

Another problem is that what may be convenient for small strings, might
actually be pretty annoying for large ones -- I often use replace on
very large strings, e.g., multi-line C expressions [and why not, it
works fine], and finding and editing around (without accidentally
deleting necessary whitespace, etc.) a little 2-4 character string in
the midst of all that could be quite bad.

Perhaps a more robust method would be to use some sort of "separator"
string like you suggest, but make it not a simple string, e.g., how

   (defvar query-replace-separator
      (propertize "\nwith: "
                  'read-only t
                  'field 'prompt
                  'face 'minibuffer-prompt
                  'rear-nonsticky t))
   (read-string "Query replace: " query-replace-separator)

[That won't quite work, but...]

That'd make the initial query-replace prompt look something like:

   Query replace: 

and allow the user to freely edit both fields at once, with M-p and M-n
operating on both!

Yes, slightly :-), but it would be a very nice interface.

Fast, small, soon; pick any 2.

reply via email to

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