Another improper option is if one writes their own very short command that ad-hoc let-binds comment-end and comment-start and calls #'comment-region inside that. But then they would need to, AFAICT, hardcode the "/*" and "*/" strings there, which is not ideal since this information should already be known to and provided by nix-mode. E.g., c-mode provides the c-block-comment-starter and c-block-comment-ender variables.
AFAICT it is not properly available through trivial combination of any existing command and customizeable variable.
One improper option is if one customizes
comment-end
andcomment-start
, but then they lose line comments (see https://emacs.stackexchange.com/questions/39291/c-mode-smartly-use-for-comment-dwim#:~:text=The%20reason%20that,syntax%20instead%20of%20%22//%22).Another improper option is if one writes their own very short command that ad-hoc
let
-bindscomment-end
andcomment-start
and calls#'comment-region
inside that. But then they would need to, AFAICT, hardcode the"/*"
and"*/"
strings there, which is not ideal since this information should already be known to and provided bynix-mode
. E.g.,c-mode
provides thec-block-comment-starter
andc-block-comment-ender
variables.To clarify, in comparison Intellij provides two independent commands: 1) for line commenting (see https://blog.jetbrains.com/idea/2022/04/comment-your-code-like-a-pro-with-intellij-idea/#:~:text=Single%2Dline%20comments%20in%20Java%20start%20with%20two%20forward%20slashes%20(//).%20To%20quickly%20add%20a%20line%20comment%20in%20IntelliJ%20IDEA%2C%20press%20%E2%8C%98%20/%20on%20macOS%20or%20Ctrl%20%2B%20/%20on%20Windows%20and%20Linux. ) and 2) for block commenting (see https://blog.jetbrains.com/idea/2022/04/comment-your-code-like-a-pro-with-intellij-idea/#:~:text=Block%20comments%20or,Windows%20and%20Linux.)