This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-01
Channels
- # beginners (41)
- # boot (25)
- # cider (34)
- # cljs-dev (221)
- # cljsrn (1)
- # clojure (191)
- # clojure-dusseldorf (4)
- # clojure-hamburg (1)
- # clojure-italy (8)
- # clojure-poland (1)
- # clojure-russia (22)
- # clojure-spec (27)
- # clojure-uk (91)
- # clojurescript (101)
- # core-async (11)
- # cursive (33)
- # data-science (9)
- # datascript (3)
- # datomic (30)
- # emacs (4)
- # events (4)
- # garden (6)
- # jobs (3)
- # leiningen (8)
- # luminus (39)
- # lumo (2)
- # off-topic (158)
- # om (13)
- # onyx (1)
- # parinfer (22)
- # planck (2)
- # protorepl (5)
- # re-frame (7)
- # reagent (10)
- # remote-jobs (1)
- # ring (1)
- # ring-swagger (20)
- # unrepl (92)
- # vim (11)
I'm trying to learn cider, and I'm a little confused about the cider-refresh
function. I'm expecting that I can add, say, a defn
to my user
namespace in dev/user.clj
, save the file, call cider-refresh
, and my fn will be available in the repl buffer. But that doesn't happen. Is my expectation correct, or have I misunderstood what cider-refresh
is intended to do?
you probably want something more along the lines of eval buffer or eval defun. Cider-refresh is more of a refresh the repl and a blank slate kind of deal rather than incremental loading of code changes.
You say it's a blank slate kind of deal…is it supposed to wipe out vars that you defined in the REPL but not in the dev/user.clj
file?
it should reload the user.clj file if that file is on the classpath and the current ns or required by the current ns... i think
my most used commands are C-M-x
for eval top level defun and C-u C-c M-z
to load the current buffer and switch to that namespace
Thanks for walking me through it…what do you mean by "top level defun"? Like the last defn
in a file? Or the ns
at the top? Or what?
I must be doing something wrong. I add a defn
to my dev/user.clj
file, then cider-refresh
, then type the new fn name at the REPL (not even trying to call it, just print it), and it tells me Unable to resolve symbol
.
Also, the old def
s that I typed into the REPL buffer but which aren't in the dev/user.clj
file are still around.
When I call cider-refresh
I see cider-refresh: Reloading successful
in my status line and Reloading successful
in my *cider-refresh-log*
buffer. So it seems like it's reporting success, but it's not doing what I expect.
So I conclude that either my expectations or my usage of cider are incorrect.
The cider docs [1] say that cider-refresh
wraps clojure.tools.namespace
, which maybe doesn't answer my question directly but it does lead me to think that what you said above is correct, that it should wipe out the repl state and reload purely from what's in the dev/user.clj
file.
[1] https://cider.readthedocs.io/en/latest/miscellaneous_features/#code-reloading
@jeff.terrell you might want to read up on the reloaded workflow by stuart sierra. the user.clj file and the user ns is somewhat special... I don't think it is a cider thing but rather as you found out already a tools.ns thing
Hi! We have custom deftest*
macro in our codebase. And we are unable to run such tests with cider. cider-nrepl receives *
as var name.
Problem is in this regexp -> https://github.com/clojure-emacs/clojure-mode/blob/da758ae3a089b8e8961958ecdf58ee94d9bd8746/clojure-mode.el#L1734
Can anyone help me to improve this regexp?
Ah, figured it out. @benedek was right, I hadn't set up my project the way that Stuart Sierra recommended in his "workflow reloaded" blog post [1]. I was missing this from my defproject
:
:profiles {:dev {:source-paths ["dev"]
:dependencies [[org.clojure/tools.namespace "0.2.3"]
[org.clojure/java.classpath "0.2.0"]]}}
Now I can reload to my heart's content.
Thanks @dpsutton and @benedek for the help!
[1] http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloadeda related idea, cider could have a reload mode where it auto injects these dependencies
or a defcustom
to do so
yeah true cider-nrepl
does: https://github.com/clojure-emacs/cider-nrepl/blob/d2858d7a7c00c491a9cba56ed6c2d3dabc0e9669/project.clj#L9
Yeah, I just tried it without the :dependencies
from the snippet above (in other words my :dev
profile is simply {:source-paths ["dev"]}
, and it worked fine. So that's good.
There's still that manual step I have to take to add the source path, but I think it's understandable that not everybody would want to have the dev/
directory in their source path simply by virtue of using cider.
@jeff.terrell ah, so your file wasn't on the classpath. That makes sense now.
I’m starting a cljs-repl with boot and then using cider-connect
but cider doesn’t seem to recognize that repl as a cljs one
no idea if that will work but this is the mechanism that determines what kind of repl you are in
see cider-repl--state-handler
for details. but after every repl interaction it gets a state of what namespace its in and what type of repl its in. not sure if this will persist.
apologies if I’m not the first to ask about this, but how can I resolve
Possibly confusing dependencies found:
[org.clojure/tools.nrepl "0.2.12" :exclusions [org.clojure/clojure]]
overrides
[cider/cider-nrepl "0.15.0"] -> [org.clojure/tools.nrepl "0.2.13" :exclusions [org.clojure/clojure]]
Consider using these exclusions:
[cider/cider-nrepl "0.15.0" :exclusions [org.clojure/tools.nrepl]]
Aborting due to :pedantic? :abort
I got this as soon as I upgraded from Cider 0.14.0 to 0.15.0.Even if I add the exclusion as suggested, it still throws that error.
My profiles.clj
now looks like
{:user {:plugins [[lein-monolith "1.0.1"]
[mvxcvi/whidbey "1.3.0" :exclusions [mvxcvi/puget]]
[lein-cljfmt "0.5.5"]
[lein-cprint "1.2.0"]]
:dependencies [[mvxcvi/puget "1.0.1"]]}
:my/repl ^:repl
{:plugins [[cider/cider-nrepl "0.15.0" :exclusions [org.clojure/tools.nrepl]]
[refactor-nrepl "2.2.0"]]}
:humane
{:injections [(require 'pjstadig.humane-test-output)
(pjstadig.humane-test-output/activate!)]
:dependencies [[pjstadig/humane-test-output "0.7.1"]]}}
and my project has :pedantic? :abort