Lee,

  You're just making a simple typo.  To get the REPL to switch to the
source file's namespace, you have several options:

  1) With the point in the source file, press C-c M-p <ENTER>

  2) With the point in the REPL, type ,in <ENTER> overtoneproject.core
<ENTER>

  3) With the point in the REPL, type (in-ns 'overtoneproject.core)

  Your mistake was to not quote overtoneproject.core, which made the
clojure compiler look up the value of the symbol as a Java class
(which it isn't unless you added a :gen-class to the ns form).  By
quoting it, in-ns gets the symbol overtoneproject.core, which is what
it uses to look up namespaces:

  clojure.core/in-ns
  ([name])
    Sets *ns* to the namespace named by the symbol, creating it if
needed.

  Happy hacking,
    ~Gary

On Jun 21, 11:09 pm, Lee Spector <lspec...@hampshire.edu> wrote:
> On Jun 16, 2011, at 11:16 AM, Sam Aaron wrote:
>
> > I just finished making a screencast primarily for new Overtone users on how 
> > to get set up with Emacs as a primary editor:
>
> >http://vimeo.com/25190186
>
> > It turns out that this should be pretty useful for Clojure hackers in 
> > general as it's really a screencast on how to set up a Clojure environment 
> > using Emacs slime, swank and cake. Just s/Overtone/your-project/
>
> > Of course, it's also great if you're interested in making music with 
> > programming languages :-)
>
> Sam,
>
> Thanks so much for this. It's quite nice and it worked for me almost without 
> a glitch (the one glitch being that I had to move a pre-existing .emacs to 
> prevent an error). If I could be excused for briefly looking a gift horse in 
> the mouth I'd also say that as a teacher I think it would be even more 
> fabulous if someone could put together  packages (presumably 
> platform-specific packages) that allowed one to do this all in one or two 
> steps, rather than five or six... Installing all of the pieces in one 
> automated process, and also adding the needed lines to the project.clj files 
> etc. Users will want to update/tweak these later, but in the same spirit of 
> this overall package I think it'd be nice to have something that works by 
> default with as few steps as possible. In any event, I do think that this is 
> already quite a nice advance.
>
> I have two (related?) questions about working in a REPL in the resulting 
> configuration:
>
> - When I have a split screen with a source file and a REPL I can't seem to 
> get the REPL into the namespace of the source file. I can do C-c C-k to 
> evaluate the file and that produces overtone output as expected (and printed 
> output goes to the REPL), but when I then try to do (in-ns 
> overtoneproject.core) in the REPL [overtoneproject.core is the name I used in 
> the ns form in the file] I get a ClassNotFoundException.
>
> - I also can't get (load "core"), or any variant that I could think of, when 
> typed in the REPL to find the file. When I look at the classpath with (seq 
> (.getURLs (java.lang.ClassLoader/getSystemClassLoader))) I see some of my 
> project's files there, so it "knows" about the project, but it doesn't find 
> my file in the src directory that cake created.
>
> Any pointers would be appreciated.
>
> Thanks,
>
>  -Lee

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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