This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # adventofcode (240)
- # beginners (87)
- # boot (4)
- # cider (27)
- # cljs-dev (20)
- # cljsrn (24)
- # clojure (365)
- # clojure-argentina (1)
- # clojure-brasil (4)
- # clojure-dev (12)
- # clojure-greece (65)
- # clojure-india (1)
- # clojure-italy (15)
- # clojure-japan (1)
- # clojure-losangeles (1)
- # clojure-madison (4)
- # clojure-poland (3)
- # clojure-russia (5)
- # clojure-spec (3)
- # clojure-uk (105)
- # clojurescript (27)
- # core-async (1)
- # core-logic (3)
- # cursive (61)
- # datomic (68)
- # devcards (4)
- # docs (27)
- # duct (67)
- # emacs (15)
- # events (1)
- # fulcro (8)
- # graphql (50)
- # lein-figwheel (1)
- # lumo (15)
- # numerical-computing (1)
- # off-topic (77)
- # om (3)
- # onyx (5)
- # parinfer (3)
- # planck (2)
- # portkey (5)
- # re-frame (4)
- # reagent (16)
- # ring (14)
- # rum (3)
- # shadow-cljs (17)
- # vim (1)
…copying a debugging question over from github to get more eyes on it. I have a function
cider-pprint-eval-defun-to-comment. It’s a variant of
cider-eval-defun-to-comment (C-c M-;) where the output is pretty-printed across multiple lines where necessary.
When the function is invoked via a keybinding it works as expected. When the function is invoked via
M-x cider-pprint-eval-defun-to-comment the function completes without appearing to insert anything into the current buffer. However, as soon as I type any other character (including navigation like C-f, C-b) that’s when the inserted comment appears.
I'm really new to elisp, but I'll look at it in a couple of hours. I want this patch to get it!
@fommil I know this is reaching way back in time, but did you ever find a solution to white-backgrounded stacktraces? https://clojurians-log.clojureverse.org/cider/2016-03-19.html "I have a dark theme (darcula) and when I get a stacktrace or test failure the default faces are all dark text on a white background." I'm experiencing the same issue.
@gonewest818 I can’t imagine what might be different. There’s no real difference between running a command with
M-x or via a keybinding.
I think what you should do is instrumenting the command with the Elisp debugger (`C-u C-M-x` while inside its body) and just step through the code and see what’s going on.
I think the issue is occurring in
execute-extended-command in simple.el, in particular there seems to be a delay while it figures out a suggested shorthand for the new command: (`You can run the command 'cider-pprint-eval-defun-to-comment' with M-x -p-d-t RET`).
If I use the suggested shorthand
M-x -p-d-t the bug doesn’t occur. Likewise if I just turn the feature off
(setq suggest-key-bindings nil).
Interesting, there’s a “fixme” comment in the implementation that says “Can be slow. Cache it maybe?” https://github.com/emacs-mirror/emacs/blob/d20161b25e9cd184d841ba9e36ee5141c01fd75f/lisp/simple.el#L1801-L1803
so… one workaround is if there is a valid keybinding for the function. In that case it just reminds you what the keybinding is, without trying to compute a shortened string.
> Does anyone know how to get emacs to respect cider indentation metadata? Would like to share formatting options across the team and it would be nice to have emacs editor support.
@tyler This only work when CIDER is running. There’s nothing special that you need to do - you just have to have this metadata attached to some definition and evaluate it.
> As far as I can tell
cider-format-buffer dispatches to cljfmt, but even when I set up cljfmt in the project, cider doesn’t seem to do anything when I try to format using that command. When I run
lein cljfmt fix it identifies the formatting errors correctly.
Well, what CIDER does is that it uses the cljfmt API to do the formatting. Not sure what you’d expect it to do.
I’ve been thinking recently about the usefulness of this, because it’s very annoying that results produced by clojure-mode + CIDER would normally differ from cljfmt. Maybe I’ll just remove this functionality at some point, as I doubt it’s useful to make people. When this was added I hope cljfmt would eventually add support for out metadata format as well.
@gfredericks The README is referring just to this. That you can use this straight from CIDER, nothing more.
The only real advantage over running the external command is that using the API in CIDER is fast, as you don’t have to wait for a process to start every time. This command was intended to used as something you’d use as file save hook for instance.