From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: general perform-replace REPLACEMENTS arg for regexp query-replacement? Date: Sat, 15 Nov 2008 10:43:18 -0800 Message-ID: <005901c94752$06ca6e70$0200a8c0@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1226774660 32680 80.91.229.12 (15 Nov 2008 18:44:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Nov 2008 18:44:20 +0000 (UTC) To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 15 19:45:21 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L1Q8y-0007fr-W5 for ged-emacs-devel@m.gmane.org; Sat, 15 Nov 2008 19:45:17 +0100 Original-Received: from localhost ([127.0.0.1]:50448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L1Q7q-0007ia-RY for ged-emacs-devel@m.gmane.org; Sat, 15 Nov 2008 13:44:06 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L1Q6z-0007PH-KJ for emacs-devel@gnu.org; Sat, 15 Nov 2008 13:43:13 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L1Q6z-0007P0-8l for emacs-devel@gnu.org; Sat, 15 Nov 2008 13:43:13 -0500 Original-Received: from [199.232.76.173] (port=39385 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L1Q6y-0007Ou-VB for emacs-devel@gnu.org; Sat, 15 Nov 2008 13:43:12 -0500 Original-Received: from rcsinet13.oracle.com ([148.87.113.125]:19391 helo=rgminet13.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L1Q6y-00050D-HW for emacs-devel@gnu.org; Sat, 15 Nov 2008 13:43:12 -0500 Original-Received: from acsinet13.oracle.com (acsinet13.oracle.com [141.146.126.235]) by rgminet13.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id mAFIhOq9022976 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 15 Nov 2008 18:43:25 GMT Original-Received: from acsmt702.oracle.com (acsmt702.oracle.com [141.146.40.80]) by acsinet13.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id mAFIhKiS012716 for ; Sat, 15 Nov 2008 18:43:21 GMT Original-Received: from dradamslap1 (/24.23.165.218) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 15 Nov 2008 10:43:06 -0800 X-Mailer: Microsoft Office Outlook 11 Thread-Index: AclHUgaffUr+N2kfSzuWjkMvFwmuWA== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Source-IP: acsmt702.oracle.com [141.146.40.80] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090202.491F183C.0010:SCFSTAT928724,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:105707 Archived-At: See 2008-08-16, thread "Then how to replace all my $$... $$ to \[ \] ..." in help-gnu-emacs. The subject line says it all. The answer, provided by Reiner Steib, was to do this: M-: (replace-string "$$" '("\\\[" "\\\]")) or this: M-: (replace-regexp "\\$\\$" '("\\\[" "\\\]")) This works too, and is quite handy: M-: (query-replace-regexp "\\$\\$" '("\\\\[" "\\\\]")) But AFAICT, you cannot use `query-replace-regexp' interactively to do this. You cannot, for instance, do this to get the same effect: C-M-% RET \$\$ RET \, '("\\\\[" "\\\\]") That just replaces "$$" by the string "(\\[ \\])". Reiner also said: "However, IMHO this neat feature should be available interactively (maybe it is?) and the documentation should not be hidden in (info "(elisp)Search and Replace") under the internal function `perform-replace'." I agree with Reiner's suggestions: please make this available to query-replacement, and please document it more prominently, even if you don't make it available interactively. Users should be made aware of this feature, preferably in the Emacs manual's discussion of text replacement. [See also my mail of today, subject "Emacs manual nodes about text replacement".]