Description
Expected behavior
Single semicolon comments can be on their own line without messing up the indentation.
This was originally reported to SO here in 2010. I recognize that the recommended Lisp style is to have double semicolons for dedicated comment lines and single semicolons only for lines with code. However, even the core Clojure code and some of the most popular Clojure libraries have uses of single semicolons on dedicated lines (clojure.core, cljs.core, instaparse). So, I implore you to support this as a non-default option.
Furthermore, this is a pain point on my team at work, since some folks are in Emacs (using clojure-mode) and others are in Vim or IntelliJ where those semicolon indentation rules aren't a problem. The Clojure codebase was written before we had Emacs users on the team, so we have 15K+ lines of code using single semicolons and now the Emacs folks are having issues. We could change all of the code, but then everyone not using Emacs would need to change the way they write comments.
Concretely, applying indentation to a file containing this should not change anything (assuming this option is enabled):
; See below.
(defn foo []
; Wow, cool!
(println "cool"))
Actual behavior
There is no configuration for this, so it's not currently possible to support. Lines containing single semicolon comments get indented by huge amounts when applying indentation to the line, range, form, or file.
Following the concrete example, the file becomes:
; See below.
(defn foo []
; Wow, cool!
(println "cool"))
Steps to reproduce the problem
Create a new file in Clojure mode, add a single semicolon comment, like:
; uh oh!
and then apply indentation to the line or file (by pressing Tab
or Enter
, for example). The line will be indented a huge amount, rather than left exactly as it was. This also applies to evil mode (hitting ==
, for example).
Environment & Version information
clojure-mode version information
This returned nil
for me. I'm using Spacemacs, which may be interfering here. I'm a Vim user, primarily, but trying to do my best to repro.
clojure-mode (version nil)
Emacs version
26.1
Operating system
This has been reproduced on:
- Arch Linux
- Ubuntu Linux
- macOS