[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: align-regexp problem when called from lisp code
From: |
Tassilo Horn |
Subject: |
Re: align-regexp problem when called from lisp code |
Date: |
Fri, 09 Aug 2013 11:40:52 +0200 |
User-agent: |
Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) |
Luca Ferrari <fluca1978@infinito.it> writes:
Hi Luca,
> Uhm...no, I was wondering to obtaining some that aligns the
> assignments and potential one line comments, so something that from
> this:
>
> a = 10; /* 10 is the inital value */
> veryLongVariableName = ( a + 2 ); /* should start two more from a */
Ah, ok, then you need to use the REPEAT argument to repeat the alignment
at = and /* throughout the line.
--8<---------------cut here---------------start------------->8---
(defun fluca1978/align-assignments (beg end)
(interactive "r")
(align-regexp beg end "\\(\\s-*\\)\\(?:=\\|/\\*\\)" 1 nil t))
--8<---------------cut here---------------end--------------->8---
This aligns
a = 10; /* 10 is the inital value */
veryLongVariableName = ( a + 2 ); /* should start two more from a */
to
a = 10; /* 10 is the inital value */
veryLongVariableName = ( a + 2 ); /* should start two more from a */
Bye,
Tassilo