[Top][All Lists]

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

Re: query-replace-regexp-eval is quite nice, but...

From: Ehud Karni
Subject: Re: query-replace-regexp-eval is quite nice, but...
Date: Mon, 2 Feb 2004 14:16:39 +0200

        Mon, 02 Feb 2004 11:24:34 +0100)
Organization: Mivtach-Simon Insurance agencies
Reply-to: address@hidden
References: <address@hidden> <address@hidden
X-Mailer: Emacs 21.3.1 rmail (send-msg 1.108)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-8-i
Content-Transfer-Encoding: 7bit

Hash: SHA1

On Mon, 02 Feb 2004 11:24:34 +0100, Andreas Schwab <address@hidden> wrote:
> David Kastrup <address@hidden> writes:
> [snip]
> >
> > So the idea is to build your replacement string with Lisp, and this
> > is quite an excellent thing.  It is completely defeated because the
> > replacement is then done non-literally.  Which means that if \0
> > would have matched \footnote, replacing the string just with \0 (which
> > one would expect to do nothing in effect) will barf because the
> > regexp replacer will not know what \f is supposed to be.
> I agree this is a bug.
> > Is there anybody that would make a case for a non-literal
> > replacement?  If not, is there anybody with enough of a clue to find
> > out how to fix this?  I have taken a look at perform-replace, but it
> > does not seem to offer an option for literal replacement for
> > regexps.  Should we add one?
> Currently, perform-replace uses literal replacement for all non-regexp
> searches, and non-literal otherwise.  What we could do is offer a special
> version of match-string that quotes backslashes and use that in
> replace-match-string-symbols.

How about checking regexp-flag (which is bound by `perform-replace') ?

Assuming your "literal" result string (containing \n) is STR you can
add something like this to your lisp:

       (if regexp-flag
           (regexp-quote STR)


- --
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 GnuPG: 98EA398D <http://www.keyserver.net/>    Better Safe Than Sorry
Comment: use http://www.keyserver.net/ to get my key (and others)


reply via email to

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