複雑な align

背景

trac wiki とかで以下のような表を書いたとする。

 ||'''ほげ'''||'''ふが'''||'''ぴよ'''||
 ||foo||bar||baz||
 ||abcdefgh||hijklmnopq||rstuvwxyz||

見づらいので整形したい。

やり方

この表をリージョン選択して、

C-u M-x align-regexp

するとミニバッファに以下のようなのが出るので、以下のように答える。

Complex align using regexp: \(||\)
Parenthesis group to modify (justify if negative): -1
Amount of spacing (or column if negative): 1
Repeat throughout line? (y or n) y

すると以下のように表が整形される。

 ||'''ほげ''' ||'''ふが''' ||'''ぴよ''' ||
 ||foo        ||bar        ||baz        ||
 ||abcdefgh   ||hijklmnopq ||rstuvwxyz  ||