I'm trying to understand what the best way to go about indentation in emacs when there are multiple IDEs being used on the project. I'm trying to use cljfmt with a config file for the rules, however, it seems like I'm competing with other modes. cljfmt support by format-all package only seems to support the whole buffer (I'm guessing that's a limitation of cljfmt). electric-indent-mode is also triggering indentation, I don't know if Cider is hooking up into that. I have LSP indentation disabled. Is it a matter of syncing the cljfmt rules with cider? Should I write an elisp function that reads those in and provides them to Cider? I went over the cider docs for indentation and I didn't quite understand how to get everything integrated.
The reason I ask is because I have a macro I'm working with that is being properly formatted by cljfmt, no problem. But the moment I press the ENTER key, something, maybe electric-indent-mode is going off of different rules.
I guess what confused me about cljfmt and cider is I didn't quite catch what mechanism cider is using to detect/use cljfmt. Since the only option that I saw was cider-format-code-options, I'm guessing that it automatically infers to use cljfmt when this is non-nil?
For instance, I have cljfmt both as a lein plugin and as a local tool. Cider says it doesn't shell out, so I'm assuming it relies on the lein plugin?
Relying on lsp is good for this. We can all share a lsp config that's shared per repo and let our lsp client do the work on save (for instance)
it works with any editor that supports clojure-lsp
and lsp uses cljfmt internally anyway, for emacs users the format-on-save is often a noop
yes, the issue isn't format-on-save, I'm using format-all which uses cljfmt. It's electric-indent-mode
Let me try with LSP again
Yeah, electric-indent-mode is the one messing things up. I could disable it, but then it would be nice if pressing ENTER would place me on the correct line indentation line, rather than at the beginning of the line
Does anyone that uses consult with immediate file previews know if I can force it to always preview files in Fundamental mode (i.e. prevent it from loading modes per filetype)?