From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jim Dai Newsgroups: gmane.emacs.help Subject: Re: Regexp replacement Date: Sat, 28 Oct 2006 15:11:30 -0400 Message-ID: References: <85iri5nzt0.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1162064430 26490 80.91.229.2 (28 Oct 2006 19:40:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 28 Oct 2006 19:40:30 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Oct 28 21:40:30 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Gdu2c-0002AA-TZ for geh-help-gnu-emacs@m.gmane.org; Sat, 28 Oct 2006 21:40:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gdu2c-0006wa-9x for geh-help-gnu-emacs@m.gmane.org; Sat, 28 Oct 2006 15:40:26 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Sat, 28 Oct 2006 14:11:32 -0500 User-Agent: Microsoft-Entourage/11.1.0.040913 Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-NNTP-Posting-Host: 67.191.149.155 Original-X-Trace: sv3-wLw0F5M5D5Ehla8euOpU2x65fCuYR+5UplFsGcNhGpjl+eLq8h6sXmpTBqExxbr7qUhfbKWOYM3lXkl!2Ah3vKehEwl6SXE7MMd0gJHO3N8xMDEjYbKUEHP4aRulYJZJRjMTXxmZJ1m2pgfzwSDUY202AwU= Original-X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Original-Xref: shelby.stanford.edu gnu.emacs.help:142747 Original-To: help-gnu-emacs@gnu.org 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:38366 Archived-At: Once again, thanks for the solution. It basically solved my problem. Two more questions: 1) I wonder if there is an easy improvement on the current method so that I have nested {} inside the text. E.g. I would like to replace \redtext{some formula $\frac{a}{b}$} to Some formula $\frac{a}{b}$. 2) I did not make it clear when I asked a key binding question. How can I bind the entire key strokes M-x query-replace-regexp RET \\redtext{\([^}]*\)} RET \1 RET into an emacs key? This key binding is to be used in LaTeX mode. Thanks. On 10/27/06 6:45 PM, in article 85iri5nzt0.fsf@lola.goethe.zz, "David Kastrup" wrote: > Jim Dai writes: > >> I would like to delete \redtext{long text} with "long text" being kept. >> I have any instances in a file, with "long text" varying that may include >> other latex symbols like _ $. (assume there are not any {} pairs inside the >> text. >> >> How can I use regexp replacement to achieve the desired changes? > > M-x query-replace-regexp RET \\redtext{\([^}]*\)} RET \1 RET