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