cider 2025-02-26

Hello folks! I am trying to get an estimate how many of you have cider-repl-use-pretty-printing enabled AND use a non-default pretty printer in cider-print-fn (Fipp, Puget, zprint). Choose โž• or โž– . Could you also please reply in the comments what is the main value for you of those third-party pretty printers? Thank you!

โž– 12
โž• 3

In my case, adding fipp as a dependency manually wouldn't be an issue. I'm already adding both cider-nrepl and nrepl manually through ~/.leiningen/profiles.clj.

๐Ÿ‘ 1

(cider-repl-use-pretty-printing t)         
(cider-print-fn 'fipp)

namespace maps also break grep i use REPL pretty printing with zprint. zprint gives me control over things like highlighting, layout, filtering/summarization.

๐Ÿ‘ 1

Given that cider-nrepl doesn't include zprint dependency itself, I assume you add it to dependencies manually? Is that OK for you?

totally. i add the zprint dep to the :cider alias in my ~/.clojure/deps.edn.

๐Ÿ‘ 1

I use Puget because of one specific old project on which the team decided they hated namespaced maps and it was necessary to make sure they never arose

Would it work for you if sometime in the future you needed to bring Puget dependency explicitly (but the rest of the integration would still work the same)?

i think so

Nothing wrong with hating namespaced maps, their readability is terrible ๐Ÿ˜…

โ˜๏ธ 2

Namespaced maps are fine as long as you use short synethetic namespaces. But namespace as FQDN is indeed terrible.

โž• 1

Even with short keys, it takes away your ability to copy pieces of data.

I use fipp (mainly for historical reasons, that may not be that relevant as of today).

๐Ÿ™ 1

cider-repl-use-pretty-printing -> t

cider-print-fn -> pprint

โž• 2
๐Ÿ™ 1

Hi everyone, Is there an easy way to make C-M-x work with custom blocks as it does with comment? When there are lots of comment blocks in my notebook, I use a def to name them so I can jump around with imenu

(comment
  (def named-block)
  ...
  ,)
I'd like to use a custom macro for this:
(defmacro def-comment
  [block-name & args])
(def-comment named-block
  ...)
My issue is that I can evaluate specific forms within comment using C-M-x; however, inside def-comment, it evaluates everything to nil

thereโ€™s a regex hardcoded in clojure-mode

you could hack on that

itโ€™s not extensible, but it is very straightforward: https://github.com/clojure-emacs/clojure-mode/blob/master/clojure-mode.el

๐Ÿ‘ 1

you can add imenu support for (comment) blocks by adjusting imenu-generic-expression defcustom

imenu-generic-expression is a variable defined in 'imenu.el'.

Its value is ((nil clojure-match-next-def 0))
Local in buffer ktl/core.clj; global value is nil

List of definition matchers for creating an Imenu index.
Each element of this list should have the form

  (MENU-TITLE REGEXP INDEX [FUNCTION] [ARGUMENTS...])

Sorry I lost the line number

so, for example, by using this

(setq-local imenu-generic-expression
            '((nil clojure-match-next-def 0)
              ("comment" "^(comment\\s-+:\\([^ )]+\\)\\s-*$" 1)))
I can jump to comment expressions like
(comment :foo
         (+ 1 2)
         )

(comment :bar
         (inc 123123)
         )

๐Ÿ˜ฎ 1
1

you can adjust the regexp to your needs of course

Oh thatโ€™s clever

๐Ÿซก 1