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: Juri Linkov
Subject: Re: query-replace-interactive not documented
Date: Wed, 16 Jun 2004 18:23:44 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

David Kastrup <address@hidden> writes:
> David Kastrup <address@hidden> writes:
>> Just working on a newer version right now.
>
> Ok, here is my current version (apart from documentation which needs
> to get added to several places, of course).  I've stolen some
> improvements from Juri in the course, but the pleasure's mutual.

That's fine with me.  I like to cooperate and share code.

> I have not added the \? proposal yet as I feel it of dubious utility:
> without a proper prompt string, it will probably feel unconvenient to
> use in particular where several \? occur, and I don't see a good
> syntax for prompt strings: mandating them to be LF-ended would
> require C-q C-j even when you don't want them after all, and you can
> easily do them with
> \,(read-string "My prompt")
> anyway.  Maybe a fixed space-terminated (not-escapable) prompt would
> do, like
> \? xxx
> to get no particular prompt string and
> \?veracity xxx
> to get "veracity" as a prompt.
>
> But I really don't like that too much.

I think \? is really useful even without a proper prompt string.

Often there is a need to prompt only for one replacement string
in cases like:

   #define X 0x001
   #define Y 0x002
   #define Z 0x003

it would be easy to do it with a simple \?:

C-M-% ^ RET #define \? 0x\# RET

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: ").

Or to let it to automatically enumerate prompt strings, i.e. to have
a counter in expression generating code in `query-replace-regexp'
that will convert several \? in the same string into prompts in a
fixed format with the prompt counter added to the prompt string:

(concat (read-string "Enter string 1: ") (read-string "Enter string 2: "))

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





reply via email to

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