From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Ehud Karni" Newsgroups: gmane.emacs.devel Subject: Re: query-replace-regexp-eval is quite nice, but... Date: Mon, 2 Feb 2004 14:16:39 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200402021216.i12CGdKb015329@beta.mvs.co.il> References: NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1075727843 17668 80.91.224.253 (2 Feb 2004 13:17:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 2 Feb 2004 13:17:23 +0000 (UTC) Cc: dak@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Feb 02 14:17:09 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Andwr-0005I6-00 for ; Mon, 02 Feb 2004 14:17:09 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1Andwr-0007N2-00 for ; Mon, 02 Feb 2004 14:17:09 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Andhq-0002GJ-Ax for emacs-devel@quimby.gnus.org; Mon, 02 Feb 2004 08:01:38 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AndgB-0002FN-U6 for emacs-devel@gnu.org; Mon, 02 Feb 2004 07:59:55 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1And3F-0005mi-Dd for emacs-devel@gnu.org; Mon, 02 Feb 2004 07:20:12 -0500 Original-Received: from [192.114.178.12] (helo=unix.mvs.co.il) by monty-python.gnu.org with esmtp (Exim 4.24) id 1And0Z-0005DL-K5; Mon, 02 Feb 2004 07:16:55 -0500 Original-Received: from beta.mvs.co.il (beta [10.253.0.3]) by unix.mvs.co.il (8.12.10/8.12.10) with ESMTP id i12CGoDa010513 for ; Mon, 2 Feb 2004 14:16:51 +0200 Original-Received: from beta.mvs.co.il (localhost [127.0.0.1]) by beta.mvs.co.il (8.12.10/8.12.10) with ESMTP id i12CGoQs015340 for ; Mon, 2 Feb 2004 14:16:50 +0200 Original-Received: (from root@localhost) by beta.mvs.co.il (8.12.10/8.12.10/Submit) id i12CGdKb015329; Mon, 2 Feb 2004 14:16:39 +0200 Original-To: schwab@suse.de In-reply-to: (message from Andreas Schwab = X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:19652 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:19652 on Mon, 02 Feb 2004 11:24:34 +0100) Organization: Mivtach-Simon Insurance agencies Reply-to: ehud@unix.mvs.co.il References: 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 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Mon, 02 Feb 2004 11:24:34 +0100, Andreas Schwab wrote: > > David Kastrup 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) STR) Ehud. - -- 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 Better Safe Than Sorry -----BEGIN PGP SIGNATURE----- Comment: use http://www.keyserver.net/ to get my key (and others) iD8DBQFAHj+mLFvTvpjqOY0RAjh3AJ4nvVP+9BbwmMCaA0GDAYIpJ16wowCeNfbV FPg2/jokXKyj9mUdIXD6T68= =IyxP -----END PGP SIGNATURE-----