From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.help Subject: Re: query-replace-regexp interactive replacement string Date: Thu, 3 Mar 2011 09:03:38 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1299139511 4415 80.91.229.12 (3 Mar 2011 08:05:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 3 Mar 2011 08:05:11 +0000 (UTC) Cc: Emacs mailing list To: suvayu ali Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 03 09:05:07 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pv3X0-0003jP-MZ for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Mar 2011 09:05:06 +0100 Original-Received: from localhost ([127.0.0.1]:49308 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pv3Wz-0004ah-0F for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Mar 2011 03:05:05 -0500 Original-Received: from [140.186.70.92] (port=59943 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pv3Vx-0004Xm-60 for help-gnu-emacs@gnu.org; Thu, 03 Mar 2011 03:04:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pv3Vv-0001aM-7t for help-gnu-emacs@gnu.org; Thu, 03 Mar 2011 03:04:01 -0500 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:51196) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pv3Vv-0001aC-3Z for help-gnu-emacs@gnu.org; Thu, 03 Mar 2011 03:03:59 -0500 Original-Received: by iyf13 with SMTP id 13so941798iyf.0 for ; Thu, 03 Mar 2011 00:03:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=OJAMqFrIYK08CKK8ircRP+5OHTctTNSBCx39zGlXw3o=; b=lj+zqeh/7j+NiVOblQn0CVuiaCaGeHevpSalrq7X6RjvWMyA0DUYAjnZdmKZD9Guf6 FHNAXHYBeAHMjH0oJI9MrPprKSvfVrZVKKhV+ay4iUfjQTwP0cDMrYDkli3isAnXisQV mHQw0Fmm+OZOg2TEkQhGU0eypeTyGnWwIg0Pc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=H5BcW7Et243e2eZp8HOXcJDpXrEy+rGmH6IH4sBokeTtGQEs5urfX3k/n0z+G+faq1 X71Jc70tWNOMoG+luzrRJkU142nBvTKHnVy55BIdPXpWFtOq0QSes/i1TITdjETf/6EH 3M+MLhG0dz4qpTCJWG3T9MbCL3W+Yk17DVapQ= Original-Received: by 10.43.46.73 with SMTP id un9mr1152129icb.398.1299139438195; Thu, 03 Mar 2011 00:03:58 -0800 (PST) Original-Received: by 10.231.15.129 with HTTP; Thu, 3 Mar 2011 00:03:38 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:79734 Archived-At: 2011/3/2 suvayu ali : > Hi Emacs users, > > I wanted to replace interactively all numbers in the text of an org-mode > document with the number in words, so I tried: > > `C-M-% [0-9]+ RET \? RET' > > But this gives me an error like this: > >> Debugger entered--Lisp error: (error "Invalid use of `\\' in replacement text") >> replace-match("\\?" t nil #("2" 0 1 (fontified t)) nil) >> match-substitute-replacement("\\?" t nil) >> perform-replace("[0-9]+" "\\?" t t nil nil nil nil nil) >> query-replace-regexp("[0-9]+" "\\?" nil nil nil) >> call-interactively(query-replace-regexp nil nil) >> recursive-edit() >> perform-replace("[0-9]+" "?" t t nil nil nil nil nil) >> query-replace-regexp("[0-9]+" "?" nil nil nil) >> call-interactively(query-replace-regexp nil nil) > > Since the doc string of `query-replace-regexp' says the following: > >> ... >> In TO-STRING, ... >> `\?' lets you edit the replacement text in the minibuffer >> at the given position for each replacement. >> ... > > I am not sure what I did wrong. I am using GNU Emacs 24.0.50.1 > (x86_64-unknown-linux-gnu, GTK+ Version 2.22.0) > Weird, it doesn't work for me either. However, if I use M-x replace-regexp it does work. In "(emacs) Regexp Replace" it also mentions \?. "If you want to enter part of the replacement string by hand each time, use `\?' in the replacement string. Each replacement will ask you to edit the replacement string in the minibuffer, putting point where the `\?' was." -- Deniz Dogan