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: align-regexp Date: Mon, 08 Dec 2008 10:02:55 +0100 Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1228729318 17150 80.91.229.12 (8 Dec 2008 09:41:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Dec 2008 09:41:58 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 08 10:43:04 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 1L9cdj-0006NB-4H for geh-help-gnu-emacs@m.gmane.org; Mon, 08 Dec 2008 10:42:55 +0100 Original-Received: from localhost ([127.0.0.1]:48254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L9ccY-0001A8-AM for geh-help-gnu-emacs@m.gmane.org; Mon, 08 Dec 2008 04:41:42 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!feeder.erje.net!proxad.net!feeder1-2.proxad.net!cleanfeed2-a.proxad.net!nnrp3-2.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (darwin) Cancel-Lock: sha1:kgGGFzuQHhephM11/whAoVJfETE= Original-Lines: 23 Original-NNTP-Posting-Date: 08 Dec 2008 10:02:55 MET Original-NNTP-Posting-Host: 82.240.200.149 Original-X-Trace: 1228726975 news-3.free.fr 7160 82.240.200.149:54251 Original-X-Complaints-To: abuse@proxad.net Original-Xref: news.stanford.edu gnu.emacs.help:165121 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:60450 Archived-At: bpatton writes: > x(a , b , c) > x(abc , boo_bar , THIS_IS_A_LONG_VARIABLE); > > How do I get align-regexp to align on all three commas? > > x(a , b , > c ); > x(abc , boo_bar , THIS_IS_A_LONG_VARIABLE); You could put the following simple command in your initfile (defun align-repeat (start end regexp) "repeatedly align using a regexp as the field separator. Works on the current region" (interactive "r\nsAlign regexp: ") (if (equal start end) (message "no region !")) (align-regexp start end (concat "\\(\\s-*\\)" regexp) 1 align-default-spacing t)) Then select your text, and type M-x align-repeat RET , RET