문제

I used to start all my comments from column 60.

Is there a trick in Emacs with which for the current line, anything after (and including) // is pushed to column 60?

Example

cmp A, B // comparing against a reference

becomes

cmp A, B <-- extra spaces added until column 60 ---> // comparing against a reference
도움이 되었습니까?

해결책

Set comment-column to 60, and hit M-;.

Note that M-; runs comment-dwim which tries to do what you mean. Notably, if the region is active, it will comment out the entire region. If this gets in your way, the command that does what you ask for above is comment-indent, which you could bind to a suitable key.

다른 팁

Set the comment-column as said by legoscia, select a region and call M-x align-regexp RET // RET. That will align your comments on the same column.

For the doc: C-h f align-regexp.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top