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

Trouble evaluating strings containing (ns #393

Closed
richcole opened this issue Oct 22, 2013 · 4 comments
Closed

Trouble evaluating strings containing (ns #393

richcole opened this issue Oct 22, 2013 · 4 comments

Comments

@richcole
Copy link

Hi,

I tried a basic lein project with the following core

(ns test.core
(:gen-class))

(defn rj [x] x)

(rj "(ns my_stuff.gossip) (str "a")(str "b")")

I evaluate the expressions one at a time. When I get to the last expression I get the following error listed at the end of this issue. Following is the content of the listed file.

I suspect this bug is easy to reproduce though. I tried to run with only cider enabled. I am running emacs23 and pulling from melpa

(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)

If I change ns to nss in the string then it works fine.

regards,

Richard.


clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Unable to resolve symbol: rj in this context, compiling:(/tmp/form-init6584996934617670068.clj:1:1)
at clojure.lang.Compiler.analyze (Compiler.java:6380)
clojure.lang.Compiler.analyze (Compiler.java:6322)
clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3573)
clojure.lang.Compiler.analyzeSeq (Compiler.java:6562)
clojure.lang.Compiler.analyze (Compiler.java:6361)
clojure.lang.Compiler.analyze (Compiler.java:6322)
clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5708)
clojure.lang.Compiler$FnMethod.parse (Compiler.java:5139)
clojure.lang.Compiler$FnExpr.parse (Compiler.java:3751)
clojure.lang.Compiler.analyzeSeq (Compiler.java:6558)
clojure.lang.Compiler.analyze (Compiler.java:6361)
clojure.lang.Compiler.eval (Compiler.java:6616)
clojure.lang.Compiler.eval (Compiler.java:6582)
clojure.core$eval.invoke (core.clj:2852)
clojure.main$repl$read_eval_print__6588$fn__6591.invoke (main.clj:259)
clojure.main$repl$read_eval_print__6588.invoke (main.clj:259)
clojure.main$repl$fn__6597.invoke (main.clj:277)
clojure.main$repl.doInvoke (main.clj:277)
clojure.lang.RestFn.invoke (RestFn.java:1096)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__612.invoke (interruptible_eval.clj:56)
clojure.lang.AFn.applyToHelper (AFn.java:159)
clojure.lang.AFn.applyTo (AFn.java:151)
clojure.core$apply.invoke (core.clj:617)
clojure.core$with_bindings_STAR_.doInvoke (core.clj:1788)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:41)
clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__653$fn__656.invoke (interruptible_eval.clj:171)
clojure.core$comp$fn__4154.invoke (core.clj:2330)
clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__646.invoke (interruptible_eval.clj:138)
clojure.lang.AFn.run (AFn.java:24)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1146)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:615)
java.lang.Thread.run (Thread.java:679)


(clojure.core/-> (java.io.File. "/tmp/form-init6584996934617670068.clj") (.deleteOnExit))(do (set! warn-on-reflection nil) (do (try (clojure.core/doto (quote test.core) clojure.core/require clojure.core/in-ns) (catch java.lang.Exception e__7342__auto__ (clojure.core/println e__7342__auto__) (clojure.core/ns test.core))) (try (clojure.core/require (quote clojure.tools.nrepl.server)) (catch java.lang.Throwable t__7343__auto__ (clojure.core/println "Error loading" (clojure.core/str (quote clojure.tools.nrepl.server) ":") (clojure.core/or (.getMessage t__7343__auto__) (clojure.core/type t__7343__auto__))))) (try (clojure.core/require (quote complete.core)) (catch java.lang.Throwable t__7343__auto__ (clojure.core/println "Error loading" (clojure.core/str (quote complete.core) ":") (clojure.core/or (.getMessage t__7343__auto__) (clojure.core/type t__7343__auto__))))) nil) (clojure.core/let [server__7338__auto__ (clojure.tools.nrepl.server/start-server :bind "127.0.0.1" :port 0 :ack-port nil :handler (clojure.tools.nrepl.server/default-handler (clojure.core/with-local-vars [wrap-init-ns__7304__auto__ (clojure.core/fn [h__7305__auto__](clojure.core/with-local-vars [init-ns-sentinel__7306__auto__ nil] %28clojure.core/fn [{:as msg__7307__auto__, :keys [session]}] %28clojure.core/when-not %28%28clojure.core/deref session%29 init-ns-sentinel__7306__auto__%29 %28clojure.core/swap! session clojure.core/assoc %28var clojure.core/ns%29 %28try %28clojure.core/require %28quote test.core%29%29 %28clojure.core/create-ns %28quote test.core%29%29 %28catch java.lang.Throwable t__7308__auto__ %28clojure.core/create-ns %28quote user%29%29%29%29 init-ns-sentinel__7306__auto__ true%29%29 %28h__7305__auto__ msg__7307__auto__%29%29))](clojure.core/doto wrap-init-ns__7304__auto__ %28clojure.tools.nrepl.middleware/set-descriptor! {:requires #{%28var clojure.tools.nrepl.middleware.session/session%29}, :expects #{"eval"}}%29 %28clojure.core/alter-var-root %28clojure.core/constantly %28clojure.core/deref wrap-init-ns__7304__auto__%29%29%29)))) port__7339__auto__ (:port server__7338__auto__) repl-port-file__7340__auto__ (clojure.core/apply clojure.java.io/file ["/home/local/ANT/richcole/clojure/test" ".nrepl-port"]) legacy-repl-port__7341__auto__ (if (.exists (clojure.java.io/file "/home/local/ANT/richcole/clojure/test/target/repl")) (clojure.java.io/file "/home/local/ANT/richcole/clojure/test/target/repl" "repl-port"))](clojure.core/when true %28clojure.core/println)) (clojure.core/spit (clojure.core/doto repl-port-file__7340__auto__ .deleteOnExit) port__7339__auto__) (clojure.core/when legacy-repl-port__7341__auto__ (clojure.core/spit (clojure.core/doto legacy-repl-port__7341__auto__ .deleteOnExit) port__7339__auto__)) (clojure.core/deref (clojure.core/promise))))

@bbatsov
Copy link
Member

bbatsov commented Oct 22, 2013

I tried your test code and it gets evaluated properly for me.

@richcole
Copy link
Author

Did you evaluate the three expressions one at a time, one after the other. I don't get the error if I evaluate the whole file but I get this error if I evaluate the expressions one at a time (C-x e).

I get the same error on ubuntu with emacs23 and on debian/stable with emacs-snapshot (emacs version 24).

I create the project like this:

$ lein new app test

then edit the test.core file

then evaluate the expressions one at a time.

here is my .emacs (for the second test case debian/stable emacs-snapshot) in case anything pops out as being wrong:

(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(setq inhibit-splash-screen t)
(setq-default indicate-empty-lines nil)

(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(font-lock-mode 0)

(global-set-key "\C-cm" 'compile)
(global-set-key "\C-cg" 'goto-line)
(global-set-key "\C-c\C-g" 'grep)
(global-set-key "\C-cr" 'replace-string)

(setq make-backup-files nil)
(set-variable 'compile-command "cd ~/RJL && rake")

(when (eq emacs-major-version 24)
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
; (package-refresh-contents)

(defvar my-packages )

(dolist (p '(cider))
(when (not (package-installed-p p))
(package-install p)))

(ido-mode 0)
(ido-ubiquitous-mode 0)
(ido-everywhere 0)
(toggle-indicate-empty-lines)
(global-set-key "\M-x" 'execute-extended-command))

@richcole
Copy link
Author

I should also mention that I run the repl with M-x cider-jack-in

@bbatsov
Copy link
Member

bbatsov commented Oct 23, 2013

Yep, I managed to reproduce it. Hopefully I'll have it fixed soon.

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