سؤال

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