From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: hufflen@lifc.univ-fcomte.fr (hufflen jean-michel) Newsgroups: gmane.emacs.bugs Subject: Re: Replacement Date: Thu, 3 Nov 2005 17:33:29 +0100 (CET) Message-ID: <20051103163329.CC26B32F1A@lifc.univ-fcomte.fr> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1131035814 30292 80.91.229.2 (3 Nov 2005 16:36:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 3 Nov 2005 16:36:54 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org, hufflen@lifc.univ-fcomte.fr Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 03 17:36:45 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EXi4t-0004aa-Mq for geb-bug-gnu-emacs@m.gmane.org; Thu, 03 Nov 2005 17:36:40 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EXi4r-00064F-Jh for geb-bug-gnu-emacs@m.gmane.org; Thu, 03 Nov 2005 11:36:37 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EXi3G-0004kP-GV for bug-gnu-emacs@gnu.org; Thu, 03 Nov 2005 11:34:58 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EXi3C-0004hj-7Q for bug-gnu-emacs@gnu.org; Thu, 03 Nov 2005 11:34:55 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EXi3B-0004gw-Qa for bug-gnu-emacs@gnu.org; Thu, 03 Nov 2005 11:34:54 -0500 Original-Received: from [194.57.88.66] (helo=lifc.univ-fcomte.fr) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EXi3B-00005u-K5 for bug-gnu-emacs@gnu.org; Thu, 03 Nov 2005 11:34:53 -0500 Original-Received: from localhost (localhost.univ-fcomte.fr [127.0.0.1]) by lifc.univ-fcomte.fr (Postfix) with ESMTP id 21E7F32EC2; Thu, 3 Nov 2005 17:33:31 +0100 (CET) Original-Received: from lifc.univ-fcomte.fr ([127.0.0.1]) by localhost (lifc.univ-fcomte.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 27710-08; Thu, 3 Nov 2005 17:33:29 +0100 (CET) Original-Received: by lifc.univ-fcomte.fr (Postfix, from userid 512) id CC26B32F1A; Thu, 3 Nov 2005 17:33:29 +0100 (CET) Original-To: ihs_4664@yahoo.com, juri@jurta.org X-Virus-Scanned: amavisd-new at lifc.univ-fcomte.fr X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:13881 Archived-At: >>From juri@jurta.org Fri Oct 28 08:14:34 2005 >(...) Thanks for your answer. >>> Let us consider a source text for LateX and assume that we want to >>> replace the command for an accented letter by the accented letter >>> itself. For example, replacing \`{a} by =C3 using the accurate >>> coding. If we look into the documentation and would like to >>> perform this operation by means of a Lisp code, that should be: >>> (beginning-of-buffer) >>> (while (re-search-forward "\\\B`{a}" nil t) >>> (replace-match "=C3 " nil nil)) >>> Unfortunately, the replacement is \`{a} =3D=3D=3D=3D> \=C3=20 >> >> "\\\B..." is the same as "\\B...". I think you meant "\\\\B..." > >Unquoted string "\\\\B" is `\\B' which matches two characters `\' and `B'. >I don't think this is what is wanted. In fact, I suspect that the problem is more complicated... Unless I miss something about the regular expressions handled by emacs. If I wish the following replacement: \^{a} or \^a ====> â and program: (while (re-search-forward "\\^{?a}?" ...) (replace-match "â" ...)) it results: \^{a} or \^a ====> \â If the replacement I wish is: \`{a} or \`a ====> à then (while (re-search-forward "\\`{?a}?" ...) (replace-match "à" ...)) does not work. I thought that a better result would be got by separating the ` character from backslashes and that is why I put: (while (re-search-forward "\\\B`{?a}?" ...) (replace-match "à" ...)) the result is the same than for the circumflex accent, that is: \`{a} or \`a ====> \à Yours sincerely, J.-M. H.