I am trying to prevent the comment in Clojure code that starts with single ;
to be align to the right. Is there a way to customize this in Emacs?
e.g. I would love to get the same result when commenting the Clojure/Lisp code ;;
and ;
There was this discussion about this a while back: https://github.com/clojure-emacs/clojure-mode/issues/516
;;
is the recommended line comment for Clojure, please consider using this style. Clojure aware editors typically have a key binding that comments using this style (or are easily configured to do so)
I was wondering why my editor kept changing my comments to two ;
As someone who came from Common Lisp, I'd instead rather implement the Emacs behavior in IntelliJ 😄
So people comment correctly.
Cursive can be configured to use ;; for comments
> is the recommended line comment for Clojure There are line comments and "end of line comments". They are not the same thing. This SO post illustrates the difference perfectly: https://stackoverflow.com/a/8825101/116395
Also:
;;; Let's talk about this block of code below ...
(some-code
doing-things
...)
And also:
;;;; Big huge section commentary, like a file header or something
For the "Big huge section commentary, like a file header or something", there's M-x comment-box
How do you make IntelliJ do that anyway? Asking for a friend who for some reason doesn't use Emacs 🙂
@cgore In the IntelliJ settings: Editor->General->Smart Keys->Clojure->Use ;; for line comments
I always use ;;
for my parts, but when I have to contribute to some project and they are using the ;
then my Emacs always pushed it to the right and I hate to introduce these changes when possible.
I view it as a teaching moment :troll:
(Actually sadly no, I just silently tweak the comment blocks in my PR.)
@vemv can you shed some light on the special meaning attached to ; ? Is there anything to it besides margin comment?
Aside from https://github.com/bbatsov/clojure-style-guide/tree/d096eaadf63a7899cda1e5051597a99f1d51b10f#comments I'd add the observation (not hinted in that link?) that margin comments can span multiple lines. I'd say Emacs is optimized for multi-line margin comments, which is why a single-line margin comment can be auto-aligned in an odd-looking position (which in the context of a multi-line comment, would be less odd) Another good read: https://www.gnu.org/software/emacs/manual/html_node/elisp/Comment-Tips.html
What that Emacs link says matches my memory from Common Lisp.
I think that must have been a convention in Lisp for quite a few decades, no idea how long.