{:title {:font 13
:width 100
;; next line is useful for visual debugging
:background :black}}
What is the idiomatic way to comment out the line with the background. That line is only needed when I want to debug. In all other cases I don’t need it. However I don’t want to just delete the line. I want this line to be in the source code so I can quickly enable it when needed.
The following is what I currently do. However I must put the closing parentheses on its own line which is not the clojure way.
{:title {:font 13
:width 100
;; next line is useful for visual debugging
;; :background :black
}}
For expressions I’m aware I can use #_ just before the opening parenthese to ignore the expression.
Each #_ discards one thing. You could say #_:background #_:black }} but I feel putting the discarders together is more in keeping with the intent to discard “one map entry” and certainly makes it easier to undiscard it.
Don’t overthink it. This is perfectly fine to do. There is no “one true Clojure Way”, keep doing what feels right. I do this constantly and not once has Clojure yelled at me.
In Emacs, selecting the key+value and then running M-x paredit-comment-dwim would do what you’re asking for. Something like that might be available in other editors too. You could edit your default comment key binding to make use of that, or add a new key binding.
But really, I’m doing this like @thheller - some manual work once in a while is okay
@Phill
That’s one I didn’t knew and a really good idea. Thanks !
@thheller
The main reason I asked this is I’d like to write ‘standard formatted’ code. I’m fairly new at clojure. And I just wanted to avoid that my code is completely changed when somebody runs it through a code formatter
@teodorlu
I’m using Doom Emacs, so I’ll definitely try this one too.