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: Tassilo Horn
Subject: Re: align-regexp problem when called from lisp code
Date: Fri, 09 Aug 2013 10:13:29 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

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

aligns that

/**
      * Here starts a comment
* and here it goes again
   * and again
 */

to

/**
 * Here starts a comment
 * and here it goes again
 * and again
 */

Is that what you mean?

Bye,
Tassilo



reply via email to

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