Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nREPL: namespace not found #149

Closed
oskarkv opened this issue May 3, 2014 · 6 comments
Closed

nREPL: namespace not found #149

oskarkv opened this issue May 3, 2014 · 6 comments

Comments

@oskarkv
Copy link

oskarkv commented May 3, 2014

I'm not 100% this is an issue with fireplace, but here goes.
I have:
lein version 2.3.4
fireplace "Use info op for :Doc" 020a10d
tools.namespace 0.2.4

To reproduce the issue:

I have 3 files:

user.clj:

ns user
  (:require [clojure.tools.namespace.repl :refer
             (refresh)]))

nonamespace/a.clj:

(ns nonamespace.a
  (:require [nonamespace.b :as b]))

(defn aa []
  (println "a"))

nonamespace/b.clj

(ns nonamespace.b)

(defn bb []
  (println "b"))

Now run (clojure.tools.namespace.repl/refresh) It should say:

:reloading (nonamespace.b nonamespace.a user)
:ok

Now, change nonamespace/b.clj to introduce an error. For example, remove the paren before defn. Run :Eval (clojure.tools.namespace.repl/refresh) in vim. It should say:

:reloading (nonamespace.b nonamespace.a)
:error-while-loading nonamespace.b
#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/defn

Note that the above step is necessary to reproduce the issue!

Now go to nonamespace/a.clj and save/write it, just to make tools.namespace reload it.
Run :Eval (clojure.tools.namespace.repl/refresh) in vim. Vim says:
nREPL: namespace not found

But, running (clojure.tools.namespace.repl/refresh) in the repl outside vim works as expected, i.e. the result is:

:reloading (nonamespace.a nonamespace.b)
:error-while-loading nonamespace.a
#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/defn

If I fix the error, i.e. replace the missing paren, and run (clojure.tools.namespace.repl/refresh) vim will keep saying nREPL: namespace not found. Restarting the repl gets rid of the problem.

@tpope
Copy link
Owner

tpope commented May 3, 2014

Can you create a temp repo (a gist would probably work) I can try on?

@oskarkv
Copy link
Author

oskarkv commented May 3, 2014

https://github.com/oskarkv/nonamespace
Note also what guns said here https://groups.google.com/forum/#!topic/clojure/TA_1QkFlJ_o
Maybe the namespace is automatically recreated if I'm in it in the ordinary repl when running (refresh), or something, and that's why it works.

@tpope
Copy link
Owner

tpope commented May 3, 2014

Actually given that I would expect a plain old :Require to get you a proper error.

@tpope
Copy link
Owner

tpope commented May 3, 2014

Had to repeat the dance a couple of times before I saw the error in question. A :Require did indeed fix it.

A potential workflow improvement would be to replace our "require on first eval" logic with "require on namespace-not-found". Given the convoluted nature of the problem, I'm not especially concerned.

@tpope
Copy link
Owner

tpope commented May 3, 2014

I should add that this replacement logic needs to work for ClojureScript too. So the first step would be checking if a missing namespace triggers namespace-not-found or some other behavior there.

@tpope
Copy link
Owner

tpope commented Jun 29, 2014

I think the fix for #161 should render this moot as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants