emacs-devel
[Top][All Lists]
Advanced

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

Re: query-replace-interactive not documented


From: David Kastrup
Subject: Re: query-replace-interactive not documented
Date: 17 Jun 2004 14:14:23 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

David Kastrup <address@hidden> writes:

> address@hidden (Kim F. Storm) writes:
> 
> > David Kastrup <address@hidden> writes:
> > 
> > > Juri Linkov <address@hidden> writes:
> > > 
> > > > It is not important what question it asks.  It would work even for
> > > > two or three different \? in one replacement string.  In rare cases
> > > > where the user needs more \?, he can use \,(read-string "My prompt:
> > > > ").
> > > > 
> > > > (concat (read-string "Enter string 1: ") (read-string "Enter string
> > > > 2: "))
> > > 
> > > Yes, I might do something like that.  
> > 
> > Maybe "Enter string: " for the first one, "Enter string 2:" etc for the
> > following strings.
> 
> Ouch, I just realized that the dialog will basically be:
> 
> Enter string: xsxa RET
> Query replace gfag with fdsfxsxa* (y/n)?
> 
> That's so weird that I don't really know if it should be a "feature"
> with its own shortcut.  Entering the strings when they might not even
> get used...

And without any visual indication what is happening right now.

> I'll just post the current untested diff (which might or might not
> work) since I'm about to fall asleep.  In case it works, people have
> something to play with.

Ok, I just redid this.  I have completely thrown out \\? again: if one
wanted to implement it, the right place would not be in preparing the
replacement list where \, is implemented, but rather during
perform-replace.

And then it should be done _after_ the question
"replace woozle with heffalump\? (y/n)?" has been answered positively,
by using a while loop that removes the first proper \? in the string
(using the "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\\\?" pattern)
and calls the replacement string editor with the cursor at the specified
location, until there is no longer an unescaped \?.  After that, the
replacement can be performed.

This will give the context (so we don't need prompt strings), it will
be flexible and convenient.  Any volunteer to put this is?

Anyway, I fixed what I posted last night, removed the skip of the
optional space (the most prominent use would have been
\,replace-count, and there is a shorthand for that by now) and added
documentation strings.  If nobody protests, I'll check in the
following patch.  It also removes \n \t warnings where they are
nonsensical.

Attachment: txtFb_3HbiC7o.txt
Description: Text Data

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

reply via email to

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