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 11:08:43 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

David Kastrup <address@hidden> writes:
>> Another option may be
>> \`read-expression optionally followed by ' which gives us
>> 
>> \\footnote{\\label{fn:\`replace-count'}}
>> 
>> as well as
>> 
>> \\footnote{\\label{fn:\`(or replace-count)}}
>> 
>> \` has somewhat more of a "will be evaluated later" scent and it has
>> the advantage that it is somewhat natural to match it up with ' in
>> case we need to explicitly end the read expression.

Perhaps \` is a better symbol than \', but having a special
meaning of ' following the expression seems wrong.  This is
an additional rule that the user should learn, and it may produce
undesirable results when users forget this rule and put ' with
the intention to use it in the replacement.

> Ok, here is the whole ugly thing: it certainly won't interfere with
> programming since it does all the work in the interactive spec (see
> C-x ESC ESC for the show.  BTW, can anybody tell me how the command
> history manages to record the last two arguments unevaluated?  I can't
> for the life of me figure out how this works), so certainly no
> security risk.

I think moving the code into the interactive spec is not needed.
There is no security risk in having it in the function body,
because the `query-flag' argument of `perform-replace' is t,
which means that even when the function `query-replace-regexp'
is called non-interactively the user can see the replacement string
and type `y' if he agrees with it.

> If somebody has a good suggestion how one could get rid of
> replace-requote in the command history, it would be nice to hear.
> But I really think that \`"\\3"' should deliver a _verbatim_ \3, or
> we could have written \`\3' in the first place.

This imposes artificial restrictions on what the user can do.  The user
may want to construct a replacement string with backreferences in the
Lisp expression.  I think that only the user should decide whether he
wants a verbatim \3 or its replacement.  He can add backslashes for
the literal meaning and write \`"\\\\3"' instead of \`"\\3"'.

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





reply via email to

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