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: Fri, 18 Jun 2004 09:43:05 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

David Kastrup <address@hidden> writes:
> Here is a sketch.  I am calling it a sketch since the string-match for
> \? should not be done for every replacement again if the replacement
> string did not contain \? in the first place.  This is a performance
> hog otherwise when doing lots of replacements automatically.

You can match it once in the beginning of the main while-loop and
store the result into a variable which would be given as an argument
of `replace-match-maybe-edit'.  There are only two places where the
next-replacement string is changed inside the loop.  One place is
where the replacement expression is evaluated.  But since evaluation
results are always quoted now, and unquoted \? can't be returned from
evaluation, so no need to re-check for \? here.  And another place is
where the user types `e' to edit the replacement string.  Since the
user can add \? to the replacement string (not in `replace-match-maybe-edit'
but in `perform-replace' in the case with (eq def 'edit-replacement)),
it should be re-checked for \? here.

But generally your changes work fine.  I only want to propose some
improvements: when the user types ! to replace all matches and the
replacement string contains \?, then matches are not highlighted in
the buffer when the user edits the replacement.  This could be
highlighted before reading the replacement string in
`replace-match-maybe-edit' by calling `replace-highlight'.

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





reply via email to

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