these sound like pretty good milestones that you can quickly put into a simple roadmap.MD and publish somewhere on the Cursive’s GitHub repository or its official website. i’m sure a lot of people (including myself) are interested in this kind of stuff.
@cfleming My macro is like this:
(defmacro ->until [predicate-fn x & forms]
(let [result (eval x)]
(if (predicate-fn result)
result
(if forms
(let [form (first forms)
threaded (if (seq? form)
(list `-> result form)
(list form result))]
`(->until ~predicate-fn ~threaded ~@(next forms)))
result))))
And can be used like this:
(->until :errors {}
((fn [x]
(prn "hej!")
(merge x {:dog "fido"})))
(assoc :errors [])
(assoc :wow :nej))
"hej!"
=> {:dog "fido", :errors []}
So anyone using my library, but not my project, will get incorrect indentation for the macro calls? Is there a plan/desire to fix this? Or has it been discussed already and rejected.
BTW, extending the syntax to say "Indent A like B" would be really great, and probably easy to implement. That's what I did years ago when I customized slime to another lisp language.
BTW(2) is there some desire to have a mutually understandable indentation specification syntax for clojure which all IDEs could choose to implement? In particular something where the macro designer can annotate on the macro definition, which will be delivered therefore with the macro to whoever uses it?
Clearly the person who delivers a macro in a library would like to make it easy for everyone to use his macro, regardless of the editor his customers choose. right?
Hmm I wasn't aware of that feature in idea, need to have a look at it
Sounds rather useful
Thanks for the updates, the voting panel would be super actually
As for your BTW(2), this goes beyond macros 🙂 It’d be amazing for there to be a cross-editor indentation ruleset.
1Yep that would be most welcome. I don't see any chance of it being clojure-official though, more like an agreement between tool developers
Same for programmatic macro descriptions to help static analysis
1☝️hi! my cursive started printing the form in the REPL when I use "Send top form to REPL" - which kinda wrecks the history (particularly since I push defn
with shortcut, then hit 'up' to replay my last form quite often)
I don't know if that's just a setting I accidentally changed, but I can't find it
ah, found it
Languages & Frameworks -> Clojure -> uncheck "Add forms sent from editor to REPL history" - in case anyone else wants to know xD
1🎉There's also Cmd-Up (or Ctrl-Up on PC) to scroll an entire form at a time in the REPL history. For example, if you have "Add to REPL history" checked, and you send a 5-line form to the REPL, you can use Cmd-Up to get to the previous REPL command instead of having to hit Up 5 times.
@cfleming There might be some changes on that front based on Rider, but I can completely understand not wanting to go down that rabbithole =)...
It wasn’t the font, it seems. Gotta try updating my OS/IntelliJ/Cursive next.
Great tip! I was not aware of this feature on IntelliJ but it works pretty well in my workflow! Thanks, @cfleming
Yes, supporting Rider would be basically a total rewrite of Cursive, since it works in a very different way to other IntelliJ plugins (more like a LSP).
1