I've been struggling with the same issues (on Windows, not that it
appears to matter).

The "line 23" in the error means the 23rd line of the function
vimclojure#ExecuteNailWithInput(nail, input, ...) in vimfiles/autoload/
vimclojure.vim.  It's unrelated to the code you're trying to execute.

I dug into this a bit and discussed with Meikel offline (next time
I'll just post to the list!).  There is a feature/bug with the way
VimClojure deals with files that use namespaces.  It seems a ns must
exist before VimClojure can evaluate code in that ns.  There's a
facility in place to make that happen (\rf), but I think there are
still some issues (or maybe just user error on my part):

>From Meikel in email:

####
To evaluate the functions in the right namespace we have to
change there, obviously. In foo.clj there is no namespace so
the forms are evaluated in the user namespace. This one is
always there as the Repl system used by VimClojure ensures
that.

In foo2.clj there is a namespace defined, but it is not created,
yet. That is a problem. Consider the following setup:

foo2.clj:
(in-ns 'test)

foo3.clj:
(ns test
 (:use some-other-stuff)
 (:load "foo2"))

What should VimClojure do when \ef'ing foo2.clj? Just creating
the namespace doesn't work, because then some-other-stuff
is missing. Also there were some special cases with :refer-clojure
where namespace must or must not exist before. I have to
check on that one. Maybe it's already obsolete.

However: Just creating the namespace doesn't work. The first
time loading the namespace use \rf (RequireFile). This uses
require to load the namespace and is setting up everything in
the right way. Afterwards you can use \ef to reload single files.

Maybe I should add this to the docs.
####

So you could try \rf, but for me this still doesn't quite work for
me.  If I have just one file:

foo.clj
--------
(ns foo)
(+ 1 1)

I can't \ef it.  I get the same "line 23" error you get.  If I \rf it
I get:

(clojure.core/load "/foo")
#<CompilerException java.io.FileNotFoundException: Could not locate
foo__init.class or foo.clj on classpath:  (REPL:0)>

I've tried making sure the path to foo.clj is on my classpath, but
that doesn't appear to work either.  Not really sure what's up.

Work-arounds I've used:

1) don't set a namespace (just work in the user ns implicitly)
2) temporarily change your ns macro to put you in the user ns.  i.e.
in my example above, changing (ns foo) to (ns user) works, since the
user ns always exists.
3) Bring up the REPL (\sr) and execute your ns macro there before
\ef'ing or \et'ing your file.

Tons of promise with this new version of VimClojure.  Just some bugs
(or user education?) to get through first.


Mark.



On Mar 13, 8:42 am, Albert Cardona <sapri...@gmail.com> wrote:
> Since this is a thread on VimClojure. First of all to say I am looking
> forward to vimclojure working perfectly. Here are some problems I don't
> understand:
>
> If I open a .clj file without the ng server running, it complains loudly
> and does not switch on syntax highlighting for clojure. Why no syntax on?
>
> So I launch the ng.
>
> The ng server is running happily, and on launching it reported:
>
>    NGServer started on 127.0.0.1, port 2113.
>
> Then I acess a .clj file. It 'works' fine, but I can't execute anything.
> Here's a snipped of a file test/patch.clj, opened from vim as "vim
> test/patch.clj", plus the overlayed error mesage triggered on pushing
> \ef to execute the whole file:
>
> -----8<------------
> (ns test.patch
>   (:import (ij.gui OvalRoi Roi ShapeRoi)
>            (ij IJ ImagePlus)
>            (ij.process ByteProcessor)
>            (ini.trakem2.display Display Patch Selection)
>            (mpicbg.trakem2.transform MovingLeastSquaresTransform)))
>
> (defn punch-alpha-hole
>   "Create an alpha hole right in the middle of an image."
>   [patch]
>   (let [ip (.getImageProcessor patch)
> Error detected while processing function
> vimclojure#EvalFile..vimclojure#Execute
> NailWithInput:
> line   23:
> E605: Exception not caught: Couldn't execute Nail! ng
> de.kotka.vimclojure.nails.
> Repl '-r' '-n' 'test.patch' '-f' 'test/patch.clj' </tmp/v953483/5
> ----8<--------------
>
> The error points to line 23, which is the first let binding here:
>
> ----8<--------------
> (defn punch-alpha-hole
>   "Create an alpha hole right in the middle of an image."
>   [patch]
>   (let [ip (.getImageProcessor patch)
>       ....
> ----8<--------------
>
> The above (complete) function runs just fine, if I run it by means other
> than vimclojure.
>
> What is vimclojure expecting? The classpath of the ng is correct and
> contains all necessary jar files. I cannot see what is wrong.
>
> I would appreciate help in understanding what the error means. Thanks.
>
> Albert
>
> --
> Albert Cardonahttp://albert.rierol.net
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to