[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: align-regexp
From: |
harven |
Subject: |
Re: align-regexp |
Date: |
Mon, 08 Dec 2008 10:02:55 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (darwin) |
bpatton <bpatton@ti.com> 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