From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: harven Newsgroups: gmane.emacs.help Subject: Re: regexp/emacs selective replace Date: Wed, 25 Nov 2009 09:15:27 +0100 Organization: http://groups.google.com Message-ID: <87skc3kokg.fsf@ergodik.univ-brest.fr> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1259138469 7648 80.91.229.12 (25 Nov 2009 08:41:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Nov 2009 08:41:09 +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 09:41:02 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 1NDDQs-0005D0-4v for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Nov 2009 09:41:02 +0100 Original-Received: from localhost ([127.0.0.1]:45233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDDQr-0004U5-NF for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Nov 2009 03:41:01 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!feeder1-2.proxad.net!cleanfeed2-b.proxad.net!nnrp9-2.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:FJtwwQbtTUyyUpUDrs8PShIH9sw= Original-Lines: 34 Original-NNTP-Posting-Date: 25 Nov 2009 09:15:42 MET Original-NNTP-Posting-Host: 78.233.232.132 Original-X-Trace: 1259136942 news-3.free.fr 11560 78.233.232.132:49708 Original-X-Complaints-To: abuse@proxad.net Original-Xref: news.stanford.edu gnu.emacs.help:175036 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:70109 Archived-At: m121212 writes: > 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? Also, is there a way Emacs can just wrap any selection with > custom, predefined tags? Anchor to the beginning and end of line. M-x replace-regexp RET ^ *\\includegraphics{[^}]*} *$ RET \\begin{center} \& \\end{center} RET