help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: align-regexp problem when called from lisp code


From: Luca Ferrari
Subject: Re: align-regexp problem when called from lisp code
Date: Fri, 9 Aug 2013 10:45:58 +0200

On Fri, Aug 9, 2013 at 10:13 AM, Tassilo Horn <tsdh@gnu.org> wrote:
> Luca Ferrari <fluca1978@infinito.it> writes:
>
>>>> --8<---------------cut here---------------start------------->8---
>>>> (defun fluca1978/align-assignments (beg end)
>>>>   (interactive "r")
>>>>   (align-regexp beg end "\\(\\s-*\\)="))
>>>> --8<---------------cut here---------------end--------------->8---
>>
>> Uhm...just for curiosity, what kind of regexp should I use if I want
>> also to align all comment starting (/*) in every row?
>
> You mean C-style multi-line comments?  This
>
> --8<---------------cut here---------------start------------->8---
> (defun fluca1978/align-comment (beg end)
>   (interactive "r")
>   (align-regexp beg end "\\(\\s-*\\)\\*" 1 0))
> --8<---------------cut here---------------end--------------->8---
>


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 */

into this:

a                                 = 10;          /* 10 is the inital value */
veryLongVariableName = ( a + 2 ); /* should start two more from a */

So I was thinking about aligning the assignments first and then the
comments (that could have been already aligned by moving the = signs).

Suggestions?

Thanks,
Luca



reply via email to

[Prev in Thread] Current Thread [Next in Thread]