[英]nrepl.el and leiningen 2 default namespace?
讓Emacs / Clojure環境啟動並運行,我現在遇到了我不確定是正常的行為。 特別是,當我啟動一個nREPL並編譯(Cc Ck)我的緩沖區時,我會被放到我的core.clj文件頂部定義的命名空間之外。 我應該添加免責聲明,我對Clojure和名稱空間有點新,所以我對這一切的理解可能是模糊的。 我願意接受那些能夠讓我看到Better Way™的自以為是的答案。
首先,關於我的設置:
我的emacs環境是Cocoa Emacs 24,主要使用Melpa存儲庫中的emacs入門工具包進行設置,並通過包管理器添加了clojure和nrepl包。
我的leiningen 2項目是使用lein new test-clj
。
我的project.clj :
(defproject test-clj "0.1.0-SNAPSHOT"
:description "A geospatial test app example mostly ripped off from http://datamangling.com/blog/2010/05/26/geotools-quickstart-in-clojure/"
:repositories {"osgeo-geotools" "http://download.osgeo.org/webdav/geotools"}
:url "FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.4.0"]
[org.geotools/gt-main "8.2"]
[org.geotools/gt-shapefile "8.2"]
[org.geotools/gt-epsg-hsql "8.2"]
[org.geotools/gt-swing "8.2"]])
我的core.clj :
(ns test-clj.core
(:import [org.geotools.data CachingFeatureSource FeatureSource FileDataStore FileDataStoreFinder])
(:import [org.geotools.map DefaultMapContext MapContext])
(:import [org.geotools.swing JMapFrame])
(:import [org.geotools.swing.data JFileDataStoreChooser]))
(defn show-shapefile
"Prompts the user for a shapefile and displays its content"
[]
(if-let [shapefile (JFileDataStoreChooser/showOpenFile "shp" nil)]
(let [fs (.getFeatureSource (FileDataStoreFinder/getDataStore shapefile))]
(doto (DefaultMapContext.)
(.setTitle "Quickstart")
(.addLayer fs nil)
(JMapFrame/showMap)))))
我想我應該能夠
Mx nrepl-jack-in
) Cc Ck
將緩沖區加載到REPL中 實際上,我得到的錯誤看起來像clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Unable to resolve symbol: show-shapefile in this context, compiling:(NO_SOURCE_PATH:1)
如果,從REPL我第一次輸入(in-ns`test-clj.core),我就是金色的。 另外,如果我輸入(test-clj.core / show-shapefile)我就設置了。
當我在逆時針加載REPL時,我會自動進入test-clj.core命名空間,這似乎很方便。
我的問題是雙重的:
只需對您的工作流程進行一些更改:
第2步編譯文件,創建命名空間
步驟3比切換到repl並運行in-ns
短
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.