emacs-devel
[Top][All Lists]
Advanced

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

Re: [patch] Re: regexp repacement, how to present replacement to user?


From: Paul Pogonyshev
Subject: Re: [patch] Re: regexp repacement, how to present replacement to user?
Date: Sun, 28 Oct 2007 16:41:28 +0200
User-agent: KMail/1.7.2

Richard Stallman wrote:
>     I think the main part of it is the offsetting and that may be used at
>     other places.  So it's the only part we want to provide.
> 
> The originally proposed function was much cleaner and easier to use
> than this offsetting function.  If this facility is useful enough to
> justify adding someting to Emacs, better to add the originally
> proposed function.
> 
> The question is whether this is useful enough to be a reason to add
> anything.

Sorry for long delay.

How about this addition using new function right inside Emacs.  In
`query-replace-regexp', hitting `t' (or anything else, doesn't matter)
will toggle between

        Query replacing REGEXP with REPLACEMENT: (C-h for help)

and

        Replace REGEXP with SUBSTITUTED-REPLACEMENT? (C-h for help)

This way you can preview replacement result, which can be useful if
your replacement string is complicated enough.

E.g. you will be able to toggle between

        Query replacing \([a-z]+\) \([a-z]+\) with \1 \2 \1: (C-h for help)

and

        Replace \([a-z]+\) \([a-z]+\) with foo bar foo? (C-h for help)

Optionally we can also toggle to `Replace MATCH...' instead of
`Replace REGEXP...', but that is probably not very useful given that
the match is highlighted in the buffer anyway.

Paul




reply via email to

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