Fork me on GitHub
Martynas M13:06:57

Hey. How do I prevent values from REPL appearing in my echo area (the one at the bottom)? It doesn't give me much use and it also lags the UI as I have fat structs in REPL. And then everything jumps around without much point because when I move my cursor again the echo area clears up and then reappears in one second. It takes about 1 second to render that bottom result so I may move several times and experience lag. And then it jumps because the bottom suddenly expands after some time when I stop moving my cursor. If you look at the attached screenshot and press <left> key then the bottom result would immediately disappear and will happen to be rerendered after one second. This is not good. The only thing I want is that nothing would jump as I investigate the data structure by moving with my text cursor. So I simply want to disable this. I also use the result buffer constantly because it's predictable and I don't use this bottom expanding-collapsing one. Reproduction: 1. Print this into REPL:

(println (->> (range 1000)
              (map (juxt identity (constantly {:key :item})))
              (into {})))
2. Go to REPL buffer and move your cursor onto the map's key or on the starting/ending paren of the data structure. 3. Result in the snapshot:

Martynas M15:06:21

Is it possible to enable evil-motion-state for cider-inspector-mode? I want to have the keybindings for movement but at the same time I want to use the default keybindings for the mode. It's also fine if I could use evil-motion-state and define my own keybindings. But all my tries to enable this mode failed because this code doesn't work: (add-hook 'cider-inspector-mode-hook (lambda () (evil-motion-state))) It doesn't enable the evil-motion-state and instead it triggers it when I navigate to the child parts of my data. I see this because the cursor changes the color for a brief moment.


Are you a user of evil-collection? If so, that may be interfering:

(add-hook 'cider-inspector-mode-hook #'evil-normalize-keymaps)
from evil-collection/modes/cider/evil-collection-cider.el

Martynas M17:06:05

I'm a user of evil-mode-based editing if you meant that. I think it didn't do anything. I evaluated this in eval-expression and the nopened the inspector. And it didn't have the keybindings. Namely what I'm looking for is to use f and repeats 5j. Do you have a full solution or is it simply an attempt to help? What should it do? The major mode there is a special-mode which prevents editing. So when I click number 5 it says in the bottom that buffer is read-only. And this where f command fails too. Edit: I didn't restart emacs though. Did it work for you?

Martynas M11:06:28

When I try the same expression and restart emacs it still doesn't work add w and other key bindings to cider-inspect mode. I also tried this but it still didn't work:

(spacemacs-evil :variables


I mean which is a separate package from evil. I'm not a spacemacs user, but it does look like spacemacs includes it, so I guess you are using it.


I would find some way of disabling it and then trying your code. I may be barking up the wrong tree, but it seems to be worth eliminating it as a cause. I can't (easily) test any of this because I don't have spacemacs.

Martynas M11:06:30

I think the problem is that the mode is re-applied when the buffer loads after it runs all of the hooks. Because if I could add a hook and in it enable evil-motion mode then I would be done. Then I would need to set up several function call bindings and that would be it. But as the mode is re-applied every time then the hook can't be run at the end and I even see the cursor blink in pink color which signals that the evil-motion state is enabled for a brief moment and then disabled again. Basically this is me fighting spacemacs and emacs where all I want is VIM style editing and motions in all of the buffers with less magic keys that you somehow need to remember and which are different for every occasion.


Yeah I totally understand. I take the other route - I only use evil for editing text in programming buffers, and accept the emacs keys for nearly everything else. evil-collection is supposed to allow you to do exactly what you are trying to do, so I'd recommend making an issue on their - this is exactly the sort of thing they should know how to fix.

Martynas M11:06:50

(but it never worked, not for Clojure's exceptions, not for test reports, not for this one too. I expected to at least try something and hope for the best.) The only thing that evil bindings work correctly on is cider-result and that has been a flawless one. You can find, you can move by word, you can multiply commands... I'll try to file the issue later. I think that evil-collection is about configuring each mode separately but I hope it's not.


Is there a way to automagically run my tests for a given function whenever I recompile that function? I see that there’s cider-auto-test-mode for running all the tests for a given namespace whenever I reload the whole namespace, but I just want to run my tests for a specific function


you can do this natively in clojure:

❯ clj
Clojure 1.11.1
user=> (use 'clojure.test)
user=> (defn foo [x] (inc x))
user=> (deftest foo-test (is (= 4 (foo 3))))
user=> (add-watch #'foo ::testing (fn [_ _ _ _] (foo-test)))
user=> (defn foo [x] (* x 2))

FAIL in (foo-test) (NO_SOURCE_FILE:1)
expected: (= 4 (foo 3))
  actual: (not (= 4 6))
user=> (defn foo [x] (+ x 32))

FAIL in (foo-test) (NO_SOURCE_FILE:1)
expected: (= 4 (foo 3))
  actual: (not (= 4 35))
user=> (defn foo [x] (inc x))

wow 1

Ohhh interesting, thanks!


There we go!

(doseq [[name ref] (ns-interns 'my-ns)]
  (let [test-fn (resolve (symbol (str "test-" name)))]
    (when (and (fn? @ref) test-fn)
       (fn [_ _ _ _]