emacs-devel
[Top][All Lists]
Advanced

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

Re: regexp repacement, how to present replacement to user?


From: David Kastrup
Subject: Re: regexp repacement, how to present replacement to user?
Date: Wed, 17 Oct 2007 08:06:37 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

Juri Linkov <address@hidden> writes:

> The only thing I don't understand why the result of evaluating \,
> expressions is displayed in the prompt, but the result of back references
> is not.  I mean why, for instance,
>
> C-M-% \(a\|b\) RET \,\1  \1 RET
>
> displays
>
> Query replacing \(a\|b\) with a \1:
>
> but not
>
> Query replacing \(a\|b\) with a a:
>
> ?

For one thing, \, expressions are turned into Lisp at a much earlier
stage.  They are no longer available at that point of time.  For
another, this variant is very handy: you can write something like

C-M-% <<<<<\(blubb\)=====\(blah\)>>>> RET \1\? RET

(for things like conflict markers) and then make the decision to edit
\1 into \2 at each replacement.

Strictly speaking, this affects the replacement editing and not the
prompt display itself so it is not a direct argument against your
proposal.  But for large replacements of this kind, the prompt might
get quite unwieldy.  And I suspect that \1/\2 quite often can be very
much multiline if they capture something delimited by some markers.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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