From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: regexp/emacs selective replace Date: Tue, 24 Nov 2009 20:30:25 -0500 Organization: A noiseless patient Spider Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1259113308 20740 80.91.229.12 (25 Nov 2009 01:41:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Nov 2009 01:41:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 25 02:41:41 2009 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.50) id 1ND6t2-0000RF-Ky for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Nov 2009 02:41:40 +0100 Original-Received: from localhost ([127.0.0.1]:34016 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ND6t2-0005TW-A5 for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Nov 2009 20:41:40 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!goblin1!goblin.stu.neva.ru!feeder.eternal-september.org!eternal-september.org!news.eternal-september.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-X-Trace: news.eternal-september.org U2FsdGVkX19qcfjVvvlSNYrqfjTlzuaypqIxWwUttuAPVQpSh2dPzgnh2jWj5ejlgr37AbQnmQx43x8wjDhiqV+V8Pob33llRnk8HmlrFJLam3aFbrjeYnVIJZDG3px3T8kD5s2JqFE= Original-X-Complaints-To: abuse@eternal-september.org Original-NNTP-Posting-Date: Wed, 25 Nov 2009 01:30:25 +0000 (UTC) User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) X-Auth-Sender: U2FsdGVkX1+XIgL9ye0NE8T4H6/o4ABhvyiKFz2IwyE= Cancel-Lock: sha1:7z4by3xiKOEi69Y+SqnBlLtwu+8= Original-Xref: news.stanford.edu gnu.emacs.help:175034 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:70108 Archived-At: In article , m121212 wrote: > Hi, > > I have a tricky problem that I'm not sure how to solve. I have a latex > document with several figure environments that look like this: > > \begin{figure} > \includegraphics{blah.ps} > \end{figure} > > but need to look like this: > > \begin{figure} > \begin{center} \includegraphics{blah.ps} \end{center} > \end{figure} > > Some of the figure environments already have this however, and I don't want > to end up with something like this: > > \begin{figure} > \begin{center}\begin{center} \includegraphics{blah.ps} > \end{center}\end{center} > \end{figure} > > Any ideas? Does query-replace-regexp do what you want? It will prompt you before each possible replacement, and you can say whether to replace that instance. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***