This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-24
Channels
- # aleph (3)
- # beginners (17)
- # boot (8)
- # cider (61)
- # cljdoc (13)
- # cljs-dev (2)
- # clojure (66)
- # clojure-boston (1)
- # clojure-italy (4)
- # clojure-nl (7)
- # clojure-russia (7)
- # clojure-spec (19)
- # clojure-uk (80)
- # clojurescript (73)
- # core-async (4)
- # cursive (6)
- # data-science (1)
- # datomic (33)
- # docs (13)
- # emacs (17)
- # figwheel-main (28)
- # fulcro (12)
- # graphql (1)
- # jobs (3)
- # leiningen (4)
- # luminus (1)
- # off-topic (1)
- # parinfer (1)
- # pedestal (46)
- # protorepl (3)
- # re-frame (30)
- # reagent (47)
- # reitit (10)
- # ring (1)
- # shadow-cljs (94)
- # spacemacs (12)
- # specter (16)
- # tools-deps (6)
- # uncomplicate (1)
- # vim (9)
I've been getting this thing lately where when I try to evaluate a form all I get is a complaint in the minibuffer saying "Namespace Not Found"
It seems in this case it started when I created a new namespace, it's there, it's saved, it's on the filesystem in the right place. I can eval the ns
form, but anything else it won't do.
tried this with two namespaces, for one doing load-file
cleared the problem, for the other it doesn't. they both contain nothing but an empty (ns) form
(-->
id "35"
op "eval"
session "8e6e275a-6335-4ead-9e78-827b408adbd4"
time-stamp "2018-07-24 15:07:34.188062715"
code "(+ 1 1)
"
column 1
file "/home/arne/Nextjournal/nextjournal/journal/server/env/dev/server/figwheel/api.clj"
line 2
ns "server.env.dev.server.figwheel.api"
)
(<--
id "35"
session "8e6e275a-6335-4ead-9e78-827b408adbd4"
time-stamp "2018-07-24 15:07:34.207152917"
status ("namespace-not-found" "done" "error")
)
when that file was first created it automatically got an ns form that read (ns server.env.dev.server.figwheel.api)
(I guess clj-refactor does that)
somehow CIDER thinks it still has that namespace, even though the ns form has been updated, and even though I restarted nREPL (!)
(setq-local cider-buffer-ns ns)
. I'm not sure how it gets set in code buffers but there is some state out there
Interesting. Guess really some buffer-local ns var must have been set, but those were never intended to be used with source files.
well i'm at a loss then. if you can give some steps to repro from a new project i can look into it but if its not worth your time i understand that as well
I'll see if it comes up again, ran into this three times in two days on three separate projects so not unlikely
@pablore You’re getting it from clj-refactor.el
and refactor-nrepl (which was recently updated).
@pablore I got the same error when using Java 1.10. I downgraded to java 1.8 and can still use clj-refactor.
@pablore you could use setenv
but I'd suggest to configure proper java system wide. I use jEnv (http://www.jenv.be/) for that.
Hey, does anyone know how to programatically evaluate something with cider and show the result in a window in Emacs? This is what I have done: http://ix.io/1igi . I think it actually works, except that I don't know how to get the output in a window in a decent way (I could insert the result into a buffer, load clojure mode and indent it, but I'm sure there's a better way). Also, what's a good resource for learning Cider internals?
@andre.peric there's the manual at https://cider.readthedocs.io/en/latest/ and i have some internal walkthroughs at http://hackingcider.com/
awesome! when you learn things make an overview of what was useful and submit a PR!
has anyone tried hacking on clojure.spec with Cider? I can’t get it to work for some very weird reasons:
#object[clojure.spec.alpha$and_spec_impl$reify__2173 0xf14b48f
"clojure.spec.alpha$and_spec_impl$reify__2173@f14b48f"] is not a
fn, expected predicate fn
I did create a deps.edn file with the appropriate :paths
When loading clojure.spec.alpha
it seems the c/and
in line 81 is pointing to spec’s and
for some reason …
It’s not really about spec usage but rather about hacking on Spec itself — as in running cider in this repo: https://github.com/clojure/spec.alpha/
I’m also not sure what could be different which is why I came here to ask if anyone else tried it 😄
https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/spec.clj in Orchard now
It’s not a project dependency at all - we check if spec is present, otherwise we just stub it.
(ns orchard.spec
(:require [clojure.walk :as walk]
[clojure.pprint :as pp]
[clojure.string :as str]))
(defmacro spec [fname & args]
`(when-let [f# (or (resolve (symbol "clojure.spec.alpha" ~fname))
(resolve (symbol "clojure.spec" ~fname)))]
(f# ~@args)))
(defmacro spec-gen [fname & args]
`(when-let [f# (or (resolve (symbol "clojure.spec.gen.alpha" ~fname))
(resolve (symbol "clojure.spec.gen" ~fname)))]
(f# ~@args)))
So, there’s basically nothing to inline - if spec’s there it will be resolved, otherwise it won’t be.
Not sure how this can cause the problems @martinklepsch mentioned.
@martinklepsch I tried it with leiningen and the same error.
It seems that the key setting is -Dclojure.spec.skip-macros=true
: https://github.com/clojure/spec.alpha/blob/master/pom.xml#L73
With it I can at least eval the alpha
namespace.
Here's my project.clj:
(defproject clojure-spec-alpha "0.2.169-SNAPSHOT"
:description "Clojure spec"
:url " "
:license {:name "Eclipse Public License"
:url ""}
:dependencies [[org.clojure/clojure "1.10.0-alpha4"]
[org.clojure/test.check "0.10.0-alpha2"]]
:source-paths ["src/main/clojure"]
:java-source-paths ["src/java"]
:target-path "target/%s"
:jvm-opts ["-Dclojure.spec.skip-macros=true"])
Interesting — thanks for the pointer!