emacs

Joseph Ferano 2025-11-25T12:43:59.899009Z

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.

Joseph Ferano 2025-11-25T12:45:11.456969Z

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.

Joseph Ferano 2025-11-25T12:46:56.408159Z

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?

Joseph Ferano 2025-11-25T12:47:44.280639Z

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?

mpenet 2025-11-25T12:49:40.758389Z

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)

mpenet 2025-11-25T12:50:01.450129Z

it works with any editor that supports clojure-lsp

mpenet 2025-11-25T12:50:34.331059Z

and lsp uses cljfmt internally anyway, for emacs users the format-on-save is often a noop

Joseph Ferano 2025-11-25T12:51:14.746009Z

yes, the issue isn't format-on-save, I'm using format-all which uses cljfmt. It's electric-indent-mode

Joseph Ferano 2025-11-25T12:51:36.265419Z

Let me try with LSP again

Joseph Ferano 2025-11-25T13:03:56.505819Z

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

Gent Krasniqi 2025-11-25T17:45:44.194559Z

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