[Top][All Lists]

[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: 18 Jun 2004 09:13:05 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Juri Linkov <address@hidden> writes:

> 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'.

Which is more or less what I do now in the current code.  However, I
am still trying to get a hang on the match-data: it needs to be in
markers when editing functions are called since the user might then
change buffers end edit stuff behind the back of the program.  Quite

I am trying to get this both correct and efficient at the same time.
Strictly speaking, one needs markers for every non-made change in the
stack when user-editing is allowed.  Perhaps one should allow only a
certain number of unmade replacements and kill off all markers
further back in the history.

> 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'.

I am still trying to get the code to do the right think which it
doesn't.  Of course, not just the fault of \? here.

David Kastrup, Kriemhildstr. 15, 44793 Bochum

reply via email to

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