Fork me on GitHub
#cider
<
2022-03-07
>
practicalli-johnny15:03:30

@stuartrexking try the eval-pprint commands when evaluating in the source code buffer - e.g. cider-pprint-eval-last-sexp or cider-pprint-eval-last-sexp-to-comment . This approach works with cider configured to use puget, so assume it should also work with zprint.

bozhidar17:03:00

CIDER 1.3 ("Ukraine") is out! More details - https://github.com/clojure-emacs/cider/releases/tag/v1.3.0

8
cider 4
❤️ 3
vemv17:03:56

ℹ️ It is good time to upgrade clj-refactor/refactor-nrepl as well! If you're a fan of cljr-slash and Stuart Sierra's https://stuartsierra.com/2015/05/10/clojure-namespace-aliases, you are in luck: now it will offer completions for newly created namespaces, even if those haven't been aliased elsewhere in the codebase. e.g. if I create a new namespace called my.prefix.foo, then in another ns I'll be able to type foo<slash> (or prefix.foo<slash>) and cljr-slash will insert a my.prefix.foo :as foo libspec in the ns form. I'm finding this crazy useful.

afleck20:03:23

is there a way to have indentation pick up specs from the :cljfmt key in lein project.clj ?

vemv21:03:32

See https://docs.cider.mx/cider/1.3/usage/misc_features.html#formatting-code-with-cljfmt You could create a piece of Lein middleware that translates+dumps the cljfmt config to a .dir-locals file, setting cider-format-code-options The pattern would look like this:

:middleware  [~(do
                 (intern 'user
                         'my-middleware
                         (fn [project]
                           (println "Do your work here with " (:cljfmt project))
                           project))
                 'user/my-middleware)]

vemv21:03:41

If you create something interesting or could use some help, feel free to ping me, I'd be happy for someone to contribute this for everyone to use :) (but other than that I don't happen to need it on a personal level)

vemv21:03:08

mmm, I'm talking about cider-format, which is a different feature from cider indentation But the principle is similar: you create Lein middleware that dumps an .el file Instead of targeting cider it should target clojure-mode. You would generate a bunch of put-clojure-indent calls. An example: https://github.com/metabase/metabase/blob/fb9e912d0bc47471024a66e3c8f59afd888e4129/.dir-locals.el#L36-L46 As for how to convert a "cljfmt indent" to a "clojure-mode indent spec", here's some inspiration: https://github.com/nedap/formatting-stack/blob/b77370f9ed972b21203b4f15197ad297688e4b29/src/formatting_stack/formatters/cljfmt/impl.clj#L38-L46

afleck21:03:57

ok, thanks for the pointers!

cider 1