Emacs の自動整形機能について質問です。
Emacs でC言語のコード中に以下のようなコメントを書き、
・各行のコメント終了位置を揃える
・枠の中身のコロンの位置を揃える
という整形を行いたいと思っています。
lang
1/* これを */ 2/*-----------------------------*/ 3/* hoge : comment1 */ 4/* fugafuga : comment2 */ 5/*-------------------------*/ 6 7/* こうしたい */ 8/*-----------------------------*/ 9/* hoge : comment1 */ 10/* fugafuga : comment2 */ 11/*-----------------------------*/
M-x align-regexp で以下のような動作をすることから、
align では、ハイフン埋めの整形は出来そうにないように思えました。
lang
1/* 「Align regexp: \(-*\)\*\/」を実行すると */ 2/* -----------------------------*/ 3/* hoge : comment1 */ 4/* fugafuga : comment2 */ 5/* -------------------------*/
そもそもこのような自動整形が可能なのか、
可能であればどのような設定・パッケージが必要か、教えていただけないでしょうか?
[2016-03-20追記]
comment-styleでは値が表示されなかったので、comment-stylesの値になりますが、
以下のように表示されました。
lisp
1((plain nil nil nil nil "Start in column 0 (do not indent), as in Emacs-20") 2 (indent-or-triple nil nil nil multi-char "Start in column 0, but only for single-char starters") 3 (indent nil nil nil t "Full comment per line, ends not aligned") 4 (aligned nil t nil t "Full comment per line, ends aligned") 5 (box nil t t t "Full comment per line, ends aligned, + top and bottom") 6 (extra-line t nil t t "One comment for all lines, end on a line by itself") 7 (multi-line t nil nil t "One comment for all lines, end on last commented line") 8 (box-multi t t t t "One comment for all lines, + top and bottom"))
回答1件
あなたの回答
tips
プレビュー