CLJX support

551 views
Skip to first unread message

Bertrand CACHET

unread,
May 20, 2014, 3:36:21 PM5/20/14
to light-table...@googlegroups.com
Hello Light Table users,

I tried to evaluate clojure code contained in a .cljx file.

I tried both Clojure and Clojure (remote nREPL) connections without success.

When I start a REPL (using Leiningen) and add a connection to it, I manage to load/require modules contained in .cljx files. But every time I evaluate inside a .cljx file or perform a load-file on a .cljx file, I endup with this


No reader function for tag +clj, compiling:(/Users/bertrand/Desktop/schema/test/cljx/schema/test_test.cljx:2:28)


Do you have any idea on how to evaluate .cljx file from Light Table ?

Thanks in advance for your help

Sincerely

Bertrand

Matt Mower

unread,
May 21, 2014, 11:54:50 AM5/21/14
to light-table...@googlegroups.com
Hi Bertrand.


On Tuesday, 20 May 2014 20:36:21 UTC+1, Bertrand CACHET wrote:

When I start a REPL (using Leiningen) and add a connection to it, I manage to load/require modules contained in .cljx files. But every time I evaluate inside a .cljx file or perform a load-file on a .cljx file, I endup with this


No reader function for tag +clj, compiling:(/Users/bertrand/Desktop/schema/test/cljx/schema/test_test.cljx:2:28)


I'm guessing but I suspect the problem lies in your project.clj. Did you install the hook? Maybe post your project.clj file.

Kind regards,

Matt

Bertrand CACHET

unread,
May 21, 2014, 5:30:17 PM5/21/14
to light-table...@googlegroups.com
Hello,

I played with the Schema project (https://github.com/Prismatic/schema) without success.

Here is the interesting part of the project file (complete version is https://github.com/Prismatic/schema/blob/master/project.clj):

:profiles {:dev {:dependencies [[org.clojure/clojure "1.5.1"]
                                  [org.clojure/clojurescript "0.0-2030"]
                                  [com.keminglabs/cljx "0.3.1"]]
                   :plugins [[com.keminglabs/cljx "0.3.1"]
                             [lein-cljsbuild "0.3.2"]
                             [com.cemerick/austin "0.1.3"]
                             [com.cemerick/clojurescript.test "0.2.2"]]
                   :hooks [leiningen.cljsbuild]
                   :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl
                                                     cljx.repl-middleware/wrap-cljx]}}



When I launch the REPL, cljx conversion and cljsbuild are called as expected. After connecting Light Table to this REPL, I'm able to evaluate clj files. But every time I evaluate content of an cljx file I got the "No reader function for tag +clj" error.

Matt Mower

unread,
May 22, 2014, 12:05:15 PM5/22/14
to light-table...@googlegroups.com
Hi Bertrand.

It looks like you do not have the CLJX hook installed in your project.clj. Here's mine:

:profiles {:dev {:dependencies [[expectations "2.0.7"]]
                   :plugins [[com.keminglabs/cljx "0.3.2"]]
                   :cljx {:builds [{:source-paths ["src/cljx"]
                                    :output-path "target/classes"
                                    :rules :clj}
                                   {:source-paths ["src/cljx"]
                                    :output-path "target/classes"
                                    :rules :cljs}
                                   {:source-paths ["test/cljx"]
                                    :output-path "target/classes"
                                    :rules :clj}
                                   {:source-paths ["test/cljx"]
                                    :output-path "target/classes"
                                    :rules :cljs}]}
                   :hooks [cljx.hooks]}}

Hope that helps.

m/


On Wednesday, 21 May 2014 22:30:17 UTC+1, Bertrand CACHET wrote:
Here is the interesting part of the project file (complete version is https://github.com/Prismatic/schema/blob/master/project.clj):

                   :hooks [leiningen.cljsbuild]

Bertrand Cachet

unread,
May 22, 2014, 4:05:20 PM5/22/14
to light-table...@googlegroups.com
Hello Matt,

Even adding clix.hooks does not solve my problem ?

What is your procedure ? What kind of connection do you use ? With Clojure or Clojure (nREPL) I got the error «No reader function for tag +clj»

Can you point me to a project for which you make it works ?

Thanks for your help

--
Bertrand
--
You received this message because you are subscribed to a topic in the Google Groups "Light Table Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/light-table-discussion/4PeDoZJ5L8E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to light-table-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matt Mower

unread,
May 23, 2014, 8:22:15 AM5/23/14
to light-table...@googlegroups.com
No specific procedure, just regular CLJ connection, it works. Can you post your whole project.clj?

m/
To unsubscribe from this group and all its topics, send an email to light-table-discussion+unsub...@googlegroups.com.

Bertrand Cachet

unread,
May 24, 2014, 3:24:25 AM5/24/14
to light-table...@googlegroups.com
Hello,

Here is the project.clj (I’m experimenting around Schema).


################ project.clj #################################################################

(defproject prismatic/schema "0.2.3-SNAPSHOT"
  :description "Clojure(Script) library for declarative data description and validation"
  :url "http://github.com/prismatic/schema"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}

  :dependencies [[potemkin "0.3.2"]]

  :profiles {:dev {:dependencies [[org.clojure/clojure "1.5.1"]
                                  [org.clojure/clojurescript "0.0-2030"]
                                  [com.keminglabs/cljx "0.3.1"]]
                   :plugins [[com.keminglabs/cljx "0.3.1"]
                             [lein-cljsbuild "0.3.2"]
                             [com.cemerick/austin "0.1.3"]
                             [com.cemerick/clojurescript.test "0.2.2"]]
                   :hooks [cljx.hooks]
                   :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl
                                                     cljx.repl-middleware/wrap-cljx]}
                   :cljx {:builds [{:source-paths ["src/cljx"]
                                    :output-path "target/generated/src/clj"
                                    :rules :clj}
                                   {:source-paths ["src/cljx"]
                                    :output-path "target/generated/src/cljs"
                                    :rules :cljs}
                                   {:source-paths ["test/cljx"]
                                    :output-path "target/generated/test/clj"
                                    :rules :clj}
                                   {:source-paths ["test/cljx"]
                                    :output-path "target/generated/test/cljs"
                                    :rules :cljs}]}}
             :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}}

  :aliases {"all" ["with-profile" "dev:dev,1.6"]}

  :jar-exclusions [#"\.cljx|\.swp|\.swo|\.DS_Store"]

  :lein-release {:deploy-via :shell
                 :shell ["lein" "deploy" "clojars"]}

  :prep-tasks ["cljx" "javac" "compile"]

  :source-paths ["target/generated/src/clj" "src/clj"]

  :resource-paths ["target/generated/src/cljs"]

  :test-paths ["target/generated/test/clj" "test/clj"]

  :cljsbuild {:test-commands {"unit" ["phantomjs" :runner
                                      "this.literal_js_was_evaluated=true"
                                      "target/unit-test.js"]}
              :builds
              {:dev {:source-paths ["src/clj" "target/generated/src/cljs"]
                     :compiler {:output-to "target/main.js"
                                :optimizations :whitespace
                                :pretty-print true}}
               :test {:source-paths ["src/clj" "test/clj"
                                     "target/generated/src/cljs"
                                     "target/generated/test/cljs"]
                      :compiler {:output-to "target/unit-test.js"
                                 :optimizations :whitespace
                                 :pretty-print true}}}})
################################################################################################

After starting a Clojure REPL, if I evaluate code in a .clj file everything is fine. But can’t interact with code containing in clix.

I use Light Table 0.6.5 and Leiningen 2.3.4 on Java 1.7.0_40

What is your configuration ?

Thanks for your time

--
Bertrand
To unsubscribe from this group and all its topics, send an email to light-table-discu...@googlegroups.com.

Bertrand Cachet

unread,
May 24, 2014, 8:00:48 AM5/24/14
to light-table...@googlegroups.com
For information I use version 0.3.3-SNAPSHOT of cljx and not 0.3.1 as specified in project.clj file I link to previous message.


--
Bertrand

Matt Mower

unread,
May 25, 2014, 8:04:20 AM5/25/14
to light-table...@googlegroups.com
Out of interest, when you use lein repl from the command line, does it compile your CLJX files then?

Oh just as a belt and braces question, you are putting your source into files with a ".cljx" extension right?

m/

Bertrand Cachet

unread,
May 25, 2014, 1:16:07 PM5/25/14
to light-table...@googlegroups.com
When I launch a REPL, first CLJX files are compiled, then cljs-build generate JavaScript. From there I can interact with my modules.

Exactly, my source code is contained in .cljx files

--
Bertrand
To unsubscribe from this group and all its topics, send an email to light-table-discu...@googlegroups.com.

Joe Osborn

unread,
Jul 5, 2014, 11:47:13 AM7/5/14
to light-table...@googlegroups.com
Bertrand, did you ever resolve this? I'm having the exact same issue. I've got a gist of my project.clj and the relevant part of my LightTable behaviors here: https://gist.github.com/JoeOsborn/ba5f022ec08c8aadeab3

If I run a repl from the command line, I can load and reload cljx files just fine.

If I connect LightTable to my project -- either through the regular Clojure session or through a remote nrepl session -- trying to evaluate terms (cmd-enter) or whole files (cmd-shift-enter) gives reader errors.

Matt, it sounds like you're successfully using CLJX in LightTable? What are your LT behaviors and the rest of your project.clj like?

Matt Mower

unread,
Jul 5, 2014, 12:35:49 PM7/5/14
to light-table...@googlegroups.com
On Saturday, 5 July 2014 16:47:13 UTC+1, Joe Osborn wrote:
Bertrand, did you ever resolve this? I'm having the exact same issue. I've got a gist of my project.clj and the relevant part of my LightTable behaviors here: https://gist.github.com/JoeOsborn/ba5f022ec08c8aadeab3

If I run a repl from the command line, I can load and reload cljx files just fine.

If I connect LightTable to my project -- either through the regular Clojure session or through a remote nrepl session -- trying to evaluate terms (cmd-enter) or whole files (cmd-shift-enter) gives reader errors.

Matt, it sounds like you're successfully using CLJX in LightTable? What are your LT behaviors and the rest of your project.clj like?

I just tried it again in my CLJX project and it's not working. I now wonder if maybe I was mistaken and confusing running something in LT with outside as I don't believe i changed anything substantial in this project for a while.

m/



Bertrand Cachet

unread,
Jul 5, 2014, 1:09:04 PM7/5/14
to light-table...@googlegroups.com
Hi Joe,

No I never manage to fix this problem. 
From the REPL, I can load/require the module implemented in a cljx file. But again when I try to load-file, REPL breaks with "no reader function for +clj"

Inside LightTable I got the same error every time I try to evaluate CLJX file.

I wonder if problem is not with CLJX/load-file interaction.

--
Bertrand
To unsubscribe from this group and all its topics, send an email to light-table-discu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages