Emacs-lisp-mode distinguishes multiple kinds of comments.
;
is an "end of line" comment when following code, or a "right-margin" comment obeyingcomment-column
when indented withindent-for-tab-command
. This style is partcilularly useful for commenting on a code detail, since the indentation and alignment deemphasizes the comment.;;
will be aligned with the indentation of surrounding code and is especially useful as a header of code sections or for longer comment text, where necessary.
I haven't seen this distinction in other modes; indent-for-comment
(M-;) will happily indent to comment-column
for end-of-line comments, but comments on their own line seem to be indented like ;;
, not like ;
.
Is there some way to make emacs allow ;
style indentation also for other modes, such as shell-script-mode?
if [ $THIS_IS = $A_CODE_LINE ]; then
# I want to be able to comment
# on the right-side margin
## and inline with
the code
fi