all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* align-regexp
@ 2008-12-07 13:33 bpatton
  2008-12-07 21:01 ` align-regexp florian.jung
  2008-12-08  9:02 ` align-regexp harven
  0 siblings, 2 replies; 3+ messages in thread
From: bpatton @ 2008-12-07 13:33 UTC (permalink / raw)
  To: help-gnu-emacs

Assume I have the collowing perl code

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: align-regexp
  2008-12-07 13:33 align-regexp bpatton
@ 2008-12-07 21:01 ` florian.jung
  2008-12-08  9:02 ` align-regexp harven
  1 sibling, 0 replies; 3+ messages in thread
From: florian.jung @ 2008-12-07 21:01 UTC (permalink / raw)
  To: help-gnu-emacs

The easiest solution to your problem is to use 'align-all-strings'
from the 'align-string'-package instead of 'align-regexp'. If the
package isn't loaded by default a simple (require 'align-string)
should do the job.

On the other hand, if you need the full power of "align-regexp" you
can call it with C-u prefix to get all the options.

Regards, Florian


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: align-regexp
  2008-12-07 13:33 align-regexp bpatton
  2008-12-07 21:01 ` align-regexp florian.jung
@ 2008-12-08  9:02 ` harven
  1 sibling, 0 replies; 3+ messages in thread
From: harven @ 2008-12-08  9:02 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-08  9:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-07 13:33 align-regexp bpatton
2008-12-07 21:01 ` align-regexp florian.jung
2008-12-08  9:02 ` align-regexp harven

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.