NixOS / nix-mode

An Emacs major mode for editing Nix expressions.
GNU Lesser General Public License v2.1
298 stars 76 forks source link

Feature request: command for block commenting #199

Open hab25 opened 6 months ago

hab25 commented 6 months ago

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 and comment-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-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.

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.)