From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Newsgroups: gmane.emacs.help Subject: Re: Reversing lines chunks at a time Date: Tue, 16 Sep 2008 13:24:40 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1221597749 31129 80.91.229.12 (16 Sep 2008 20:42:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Sep 2008 20:42:29 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 16 22:43:25 2008 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 1KfhOO-0004yh-G3 for geh-help-gnu-emacs@m.gmane.org; Tue, 16 Sep 2008 22:43:25 +0200 Original-Received: from localhost ([127.0.0.1]:34654 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KfhNM-0005y6-MI for geh-help-gnu-emacs@m.gmane.org; Tue, 16 Sep 2008 16:42:20 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!b2g2000prf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 45 Original-NNTP-Posting-Host: 24.6.185.159 Original-X-Trace: posting.google.com 1221596680 27319 127.0.0.1 (16 Sep 2008 20:24:40 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 16 Sep 2008 20:24:40 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b2g2000prf.googlegroups.com; posting-host=24.6.185.159; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:162370 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:57712 Archived-At: On Sep 16, 2:07 am, Rupert Swarbrick wrote: > Hi, > > I have the following sort of transformation that I have to do fairly > often. For example, when writing LaTeX code, I might have a line in > maths mode which looks like > > G_*[n] =3D G_* \times \Delta^n > > (this defines the left hand side to be the Cartesian product of a G with > a star and a capital delta with a superscript n, for those reading who > aren't au fait with LaTeX). Anyway, suppose I wanted the product the > other way round: > > G_*[n] =3D \Delta^n \times G_* > > I'm using Auctex, which is pretty brilliant, but it's syntax table > breaks at quite a few characters other than whitespace for word > boundaries. I don't particularly want to change that: it seems > reasonable, but it means that the transpose-* commands don't really help > in this case: you end up mangling together bits of the various > sections. > > Moreover, I sometimes don't bother, say, putting a space before the > \times, which is still perfectly fine LaTeX, but it means that there > would be no way for Auctex to sensibly see what to do. > > At the moment, I do a crazy jumping forward and back, killing and > yanking, but I suspect there's a better way! Before I started hacking > elisp, I was wondering whether there was already a neat way to solve > this sort of problem that I didn't know about? harven suggested a solution that uses syntax table. i'd just write a simple elisp that process the current line or region. This is such as good exercise if you haven't tried elisp for text processing yet. The functions listed in this page is probably all you need: http://xahlee.org/emacs/elisp_common_functions.html Xah =E2=88=91 http://xahlee.org/ =E2=98=84