[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

50. Align Text to a Specific Column, By Regexp

This mode allows you to align regions in a context-sensitive fashion. The classic use is to align assignments:

 
  int a = 1;
  short foo = 2;
  double blah = 4;

becomes

 
  int    a    = 1;
  short  foo  = 2;
  double blah = 4;

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

50.1 Align Usage

To configure the package, type:

 
  M-x customize-group RET align RET

There are several variables which define how certain "categories" of syntax are to be treated. These variables go by the name ‘align-CATEGORY-modes’. For example, "c++" is such a category. There are several rules which apply to c++, but since several other languages have a syntax similar to c++ (e.g., c, java, etc), these modes are treated as belonging to the same category.

If you want to add a new mode under a certain category, just customize that list, or add the new mode manually. For example, to make jde-mode a c++ category mode, use this code in your initialization file:

 
  (setq align-c++-modes (cons 'jde-mode align-c++-modes))

In some programming modes, it’s useful to have the aligner run only after indentation is performed. To achieve this, customize or set the variable ‘align-indent-before-aligning’ to t.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Aidan Kehoe on December 27, 2016 using texi2html 1.82.