Fork me on GitHub
#cider
<
2024-05-13
>
didibus05:05:20

How do I test style/indent meta? I feel I keep changing it but when I format it always formats the same way

1
jumar08:05:46

I remember I had these problems in the past too. Eager to hear other people’s advice

vemv11:05:51

M:- (put-clojure-indent 'let-404 0) where 0 is an indent spec (CIDER indent spec matches clojure-mode's 1:1) then emacs just knows how to indent let-404 and it will work in all related functions (e.g. indent-for-tab-command)

didibus17:05:35

So I always have to explicitly configure each function? Can't cider/clojure-mode automatically pick up the meta?

vemv17:05:56

You asked about how to test it :) put-clojure-indent is a sure-fire means of testing the effect of a particular choice CIDER is responsible of picking up :style/indent and dynamically building clojure-mode indents out of them It can also infer indents in selected cases https://docs.cider.mx/cider/indent_spec.html#indentation-inference

👍 1
didibus18:05:54

Ya I did. I guess my follow up question is if cider is supposed to pick it up automatically? And why it's not in this case? Does it need some cache deleted, or do I have to restart the repl, etc.

vemv18:05:37

Code has to be evaled, since code insights are runtime-powered. You can re-eval a defmacro and its indents will be refreshed, if they changed Other than that it should work - if it doesn't, issue welcome

didibus03:05:41

Hum... I'm wondering two things: 1. Could inference overrule my meta? 2. Could clojure-lsp mess with indent rules?

didibus03:05:12

Ok, it does seem it has something to do with indent inference. If I rename it to something very dif different it works. So ya, even put-clojure-indent doesn't work in my case.

didibus03:05:45

If you have something called while! or do-while! it seems you cannot change the indent even with meta or through put-clojure-indent, and that it will always be indent 1

vemv10:05:50

can you show me its arglist and indent?