Re: Help! My slime-fu is broken!

2009-12-15 Thread Mike K
On Dec 15, 8:42 pm, Phil Hagelberg  wrote:

> > Ah, OK.  That explains the overload of the term "compile"
>
> I'll add a note to this to the swank-clojure readme.

Cool.

> I wasn't even aware that the CL version provided error navigation
> here. But it looks like it shouldn't be too hard to fix now that you've
> made me aware of the problem.

Great!

>  Note that in sldb (debugger) buffers
> pressing "v" on a stack trace frame will actually jump to the cause of
> the error if possible.

Well then, here's another potential bug report / teachable moment :-)

I inserted an intentional typo in my code and then used slime-load-
file (^C^L).  I get an sldb buffer as follows:

java.lang.Exception: Unable to resolve symbol: lfjd in this context
(hi.clj:0)
  [Thrown class clojure.lang.Compiler$CompilerException]

Restarts:
 0: [ABORT] Return to SLIME's top level.
 1: [CAUSE] Throw cause of this exception

Backtrace:
  0: clojure.lang.Compiler.analyze(Compiler.java:4340)
  1: clojure.lang.Compiler.analyze(Compiler.java:4286)
  2: clojure.lang.Compiler.eval(Compiler.java:4536)
  3: clojure.lang.Compiler.load(Compiler.java:4857)
  4: clojure.lang.Compiler.loadFile(Compiler.java:4824)
  5: clojure.lang.RT$4.invoke(RT.java:273)
  6: swank.commands.basic$load_file__801.invoke(basic.clj:129)
  7: clojure.lang.Var.invoke(Var.java:346)
  8: user$eval__1256.invoke(NO_SOURCE_FILE)
  9: clojure.lang.Compiler.eval(Compiler.java:4532)
 10: clojure.core$eval__3990.invoke(core.clj:1728)
 11: swank.core$eval_in_emacs_package__366.invoke(core.clj:55)
 12: swank.core$eval_for_emacs__443.invoke(core.clj:123)
 13: clojure.lang.Var.invoke(Var.java:354)
(etc)

One suspicious thing is that the Exception line is reporting line
number 0 whereas the actual typo is at line 3.  Actually, further
digging indicates that the line number is correctly reported if the
typo is an undefined symbol being used as a function, e.g.,
(misspelled-func-name foo), but not if garbage appears outside of a
form like above, i.e.,  lfjd typed on a line by itself.  This behavior
with the line number reporting is consistent whether in sldb buffers
as above or as reported in slime compilation buffers after slime-
compile-and-load-file (^C^K).

Moreover, if I try to view the source on any of the stack frame lines
(v) I simply get an "evaluation aborted" message.  In this scenario,
would you expect "v" to work on any of the stack frames?  In general,
should "v" work on frames coming out of .java files (like frame 0) or
only .clj files (like frame 6).  Again, in my case, it doesn't work
anywhere.

   Thanks,
   Mike

-- 
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


Re: Help! My slime-fu is broken!

2009-12-15 Thread Mike K


On Dec 15, 8:26 am, David Nolen  wrote:
>
> Rereading your post I realize that most of your concerns are about the
> general unfriendliness of SLIME and not so much that it isn't working. As
> Phil alludes, SLIME wasn't designed with Clojure in mind, so a lot of things
> happen that don't make a lot of sense (SLIME with Common Lisp is much more
> sensible).
>
> Beside C-c C-k, it sounds like your setup is in fact working well enough for
> you write programs?

Absolutely.  Having no background with SLIME (in particular not
understanding that its CL roots might cause some impedance mismatches
in its interface with Clojure) I just started exploring the menu
options.  My expectation was that virtually everything would "just
work" given emacs' general reputation for hosting lisp variants.  When
I saw a lot of quirks, I thought I might have a broken install or I
might be running into functionality that works fine under *nix but is
broken under Windows (a common occurrence).  So a lot of this exercise
is about recalibrating my expectations as to what should work.  Alas,
googling turns up little in this regard wrt SLIME + Clojure.

   Mike

-- 
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


Re: Help! My slime-fu is broken!

2009-12-15 Thread Phil Hagelberg
Mike K  writes:

> (add-to-list 'load-path "C:\\Program Files (x86)\\Clojure Box\\swank-
> clojure")
>
> (require 'swank-clojure-autoload)

Sounds like you're using an old-ish version of swank-clojure; the
autoloads are now generated automatically by elpa.

>> Slime was designed for use with Common Lisp, which has a distinction
>> between compiled and interpreted code. Clojure has no interpreter, so
>> any way of loading in the code runs it through the compiler.
>
> Ah, OK.  That explains the overload of the term "compile"

I'll add a note to this to the swank-clojure readme.

>> There are some features of Slime that have not been ported to Clojure
>> yet and still only work in CL. Unfortunately the author of the Clojure
>> port has dropped it and I am left maintaining it myself, and there are
>> still several portions of the code that I haven't gotten a chance to
>> dive into yet.
>
> Oh, so can you confirm that error navigation is basically broken?
> Actually, I guess the relevant question is what CB 1.0's level of
> functionality is.  If I can get access to a machine without emacs
> currently installed on it, I'll try to run the straight CB install and
> see how it behaves.

I wasn't even aware that the CL version provided error navigation
here. But it looks like it shouldn't be too hard to fix now that you've
made me aware of the problem. Note that in sldb (debugger) buffers
pressing "v" on a stack trace frame will actually jump to the cause of
the error if possible.

-Phil

-- 
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


Re: Help! My slime-fu is broken!

2009-12-15 Thread David Nolen
On Tue, Dec 15, 2009 at 2:08 AM, Mike K  wrote:

> I hadn't considered another IDE.  Clojure is my first real exposure to
> the JVM, so I'm not familiar with Java IDEs.  OTOH, Emacs has been my
> editor of choice for over two decades (yikes!) so it's definitely home
> turf for me.  Besides, I'm already addicted to paredit mode :-)
>
> However, maybe the slime+Clojure picture is generally less stable than
> I thought it would be.
>

Emacs veteran!

Rereading your post I realize that most of your concerns are about the
general unfriendliness of SLIME and not so much that it isn't working. As
Phil alludes, SLIME wasn't designed with Clojure in mind, so a lot of things
happen that don't make a lot of sense (SLIME with Common Lisp is much more
sensible).

Beside C-c C-k, it sounds like your setup is in fact working well enough for
you write programs?

David


>
>   Mike
>
> --
> 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
>

-- 
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

Re: Help! My slime-fu is broken!

2009-12-14 Thread Mike K
On Dec 14, 10:40 pm, David Nolen  wrote:
> While I personally use Emacs+SLIME to do Clojure hacking this is generally a
> poor introduction to Clojure for newbies. Clojure is new enough territory
> without having to fight with your text editor and the idiosyncracies of
> SLIME (SLIME hasn't even been compatible with swank-clojure since late
> October). Have you considered trying out NetBeans + Enclojure?

I hadn't considered another IDE.  Clojure is my first real exposure to
the JVM, so I'm not familiar with Java IDEs.  OTOH, Emacs has been my
editor of choice for over two decades (yikes!) so it's definitely home
turf for me.  Besides, I'm already addicted to paredit mode :-)

However, maybe the slime+Clojure picture is generally less stable than
I thought it would be.

   Mike

-- 
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


Re: Help! My slime-fu is broken!

2009-12-14 Thread Mike K
On Dec 14, 10:55 pm, Phil Hagelberg  wrote:

> How did you install slime? If you use trunk of slime you will run into
> breaking changes for which swank-clojure hasn't been updated yet. It's
> best to use ELPA, the Emacs package manager. (http://tromey.com/elpa)

I tried to use ELPA at first but I ran into some issues that I no
longer recall.  I ended up installing Clojure Box 1.0 from
http://clojure.bighugh.com thinking that would give me a consistent
collection of pieces.  Since I already had a pretty extensively
customized emacs already installed, I didn't use the emacs from
clojure box.  Instead I modified my _emacs file to use the pieces CB
installed.

The relevant portion of my _emacs is:

;; clojure-mode

(add-to-list 'load-path "C:\\Program Files (x86)\\Clojure Box\\clojure-
mode")
(require 'clojure-mode)

;; swank-clojure

(add-to-list 'load-path "C:\\Program Files (x86)\\Clojure Box\\swank-
clojure")

(require 'swank-clojure-autoload)

(swank-clojure-config
 (setq swank-clojure-jar-path "C:\\Program Files (x86)\\Clojure Box\
\clojure\\clojure-1.0.0.jar")
 (setq swank-clojure-extra-classpaths (list
   "C:\\Program Files (x86)\
\Clojure Box\\clojure-contrib\\clojure-contrib.jar"
   "C:\\projects\\clojure\
\ProgrammingClojure.code"
   )
   )
 )

;; slime

(eval-after-load "slime"
  '(progn (slime-setup '(slime-repl

(add-to-list 'load-path "C:\\Program Files (x86)\\Clojure Box\\slime-
cvs")
(require 'slime)
(slime-setup)


> > Annoyingingly, emacs claims "C-c C-k is undefined" when I ask the help
> > system about that binding.
>
> Sounds like you're invoking help from a context in which slime-mode is
> not enabled; probably due to installing by hand and forgetting a step?

I did some more digging and solved this one myself.  I had rebound
"help-for-help" to an alternate key sequence so that I could use ^H
for something else that I now no longer need.  When I reverted these
changes, ^H k C-c C-k worked as expected.

> Slime was designed for use with Common Lisp, which has a distinction
> between compiled and interpreted code. Clojure has no interpreter, so
> any way of loading in the code runs it through the compiler.

Ah, OK.  That explains the overload of the term "compile"

> > [error navigation woes]
>
> There are some features of Slime that have not been ported to Clojure
> yet and still only work in CL. Unfortunately the author of the Clojure
> port has dropped it and I am left maintaining it myself, and there are
> still several portions of the code that I haven't gotten a chance to
> dive into yet.

Oh, so can you confirm that error navigation is basically broken?
Actually, I guess the relevant question is what CB 1.0's level of
functionality is.  If I can get access to a machine without emacs
currently installed on it, I'll try to run the straight CB install and
see how it behaves.

   Thanks,
   Mike

-- 
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


Re: Help! My slime-fu is broken!

2009-12-14 Thread Phil Hagelberg
Mike K  writes:

> I've a Clojure newbie, and I've just started running clojure-mode and
> slime under emacs (on Windows). I'm running into several issues.  Some
> of these are definitely bugs in my understanding; others may be bugs
> in my install or the implementation itself. I'd appreciate any help
> anyone can provide on the following questions:

How did you install slime? If you use trunk of slime you will run into
breaking changes for which swank-clojure hasn't been updated yet. It's
best to use ELPA, the Emacs package manager. (http://tromey.com/elpa)

> Annoyingingly, emacs claims "C-c C-k is undefined" when I ask the help
> system about that binding.

Sounds like you're invoking help from a context in which slime-mode is
not enabled; probably due to installing by hand and forgetting a step?

> In any event, I'm not quite sure what "compile" means in this
> context.  Is this truly "AOT compile into class files", or is it
> something more general?  I suspect it's the latter; I don't see class
> files being generated anywhere.  If the file I'm "compiling" contains
> no errors, the effect seems to be just like ^C^L except that the
> minibuffer says something like "Compilation finished: 0 errors  0
> warnings  0 notes [0.00 secs]"  Is there any important difference
> between the two here?

Slime was designed for use with Common Lisp, which has a distinction
between compiled and interpreted code. Clojure has no interpreter, so
any way of loading in the code runs it through the compiler.

> If there are errors, e.g., an intentional typo, other strangeness
> occurs.  I'll get a message like "Compilation failed: 2 errors  0
> warnings  0 notes [0.00 secs]".  Fine. From the file.clj buffer, I
> think I should be able to use M-n and M-p to navigate amongst the
> errors (or is it the notes?) but I only get "No next note."

There are some features of Slime that have not been ported to Clojure
yet and still only work in CL. Unfortunately the author of the Clojure
port has dropped it and I am left maintaining it myself, and there are
still several portions of the code that I haven't gotten a chance to
dive into yet.

-Phil

-- 
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


Re: Help! My slime-fu is broken!

2009-12-14 Thread David Nolen
While I personally use Emacs+SLIME to do Clojure hacking this is generally a
poor introduction to Clojure for newbies. Clojure is new enough territory
without having to fight with your text editor and the idiosyncracies of
SLIME (SLIME hasn't even been compatible with swank-clojure since late
October). Have you considered trying out NetBeans + Enclojure?

Once you're familiar with Clojure you might later find making the transition
to Emacs+SLIME easier. Or not. NetBeans + Enclojure is very good.

David

On Mon, Dec 14, 2009 at 11:54 PM, Mike K  wrote:

> Hello Clojurians,
>
> I've a Clojure newbie, and I've just started running clojure-mode and
> slime under emacs (on Windows). I'm running into several issues.  Some
> of these are definitely bugs in my understanding; others may be bugs
> in my install or the implementation itself. I'd appreciate any help
> anyone can provide on the following questions:
>
> Slime seems to be working to a degree.  I have a functional repl, but
> I have some issues with "compiling":
>
> I know that ^C^L from clojure mode will load a file (defaults to the
> file associated with te current buffer), and that this is in effect
> the equivalent of typing the file's contents directly into the repl.
> There is also ^C^K which the slime menu describes as compile/load
> file.
>
> Annoyingingly, emacs claims "C-c C-k is undefined" when I ask the help
> system about that binding.
>
> In any event, I'm not quite sure what "compile" means in this
> context.  Is this truly "AOT compile into class files", or is it
> something more general?  I suspect it's the latter; I don't see class
> files being generated anywhere.  If the file I'm "compiling" contains
> no errors, the effect seems to be just like ^C^L except that the
> minibuffer says something like "Compilation finished: 0 errors  0
> warnings  0 notes [0.00 secs]"  Is there any important difference
> between the two here?
>
> If there are errors, e.g., an intentional typo, other strangeness
> occurs.  I'll get a message like "Compilation failed: 2 errors  0
> warnings  0 notes [0.00 secs]".  Fine. From the file.clj buffer, I
> think I should be able to use M-n and M-p to navigate amongst the
> errors (or is it the notes?) but I only get "No next note."
>
> If I then go to the *SLIME Compilation* buffer, I'll see something
> like this:
>
> 2 compiler notes:
> error:
> java.lang.Exception: Unable to resolve symbol: greeto in this context
> (hi.clj:3)
> error:
> java.lang.Exception: Unable to resolve symbol: greeto in this context
>
>
> I'm not sure why the same error is appearing twice, but the first
> instance even has the correct source code filename and line number. I
> try to navigate from here by pressing enter.  No matter what line I'm
> on when I press enter, emacs says "No error here".  Huh?
>
> If, instead, I load the file with the typo with ^C^L I get a new
> buffer in sldb mode, as shown below:
>
> java.lang.Exception: Unable to resolve symbol: greeto in this context
> (hi.clj:3)
>  [Thrown class clojure.lang.Compiler$CompilerException]
>
> Restarts:
>  0: [ABORT] Return to SLIME's top level.
>  1: [CAUSE] Throw cause of this exception
>
> Backtrace:
>  0: clojure.lang.Compiler.analyze(Compiler.java:4340)
>  1: clojure.lang.Compiler.analyze(Compiler.java:4286)
>  ... etc ...
>
> Clearly this is a debugger.  I won't ask for details as to what I can
> do here, except for this:  Typing 0 will get me back to the repl.
> Fine.  However, Typing 1 will "Throw cause of this exception".  What
> exactly does that mean?  Is it rethrowing the same exception, or doing
> something different?  How is it useful?
>
> Thanks to anyone who can help me with any of these issues.
>
>   Mike
>
> --
> 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
>

-- 
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

Re: Help! My slime-fu is broken!

2009-12-14 Thread Richard Newman
I can answer this part:

> Clearly this is a debugger.  I won't ask for details as to what I can
> do here, except for this:  Typing 0 will get me back to the repl.
> Fine.  However, Typing 1 will "Throw cause of this exception".  What
> exactly does that mean?  Is it rethrowing the same exception, or doing
> something different?  How is it useful?

Java Exceptions can have a cause, which is intended to be the  
Throwable that caused this Exception to arise.

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Exception.html#Exception(java.lang.Throwable)

For example, Clojure throws RuntimeExceptions to evade checked  
exceptions, so the original Exception is hiding as the cause of the  
RuntimeException.

"Throw cause" will essentially unwrap one layer of exceptions.

I've never used this feature in interactive debugging, mind you :)

-- 
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


Help! My slime-fu is broken!

2009-12-14 Thread Mike K
Hello Clojurians,

I've a Clojure newbie, and I've just started running clojure-mode and
slime under emacs (on Windows). I'm running into several issues.  Some
of these are definitely bugs in my understanding; others may be bugs
in my install or the implementation itself. I'd appreciate any help
anyone can provide on the following questions:

Slime seems to be working to a degree.  I have a functional repl, but
I have some issues with "compiling":

I know that ^C^L from clojure mode will load a file (defaults to the
file associated with te current buffer), and that this is in effect
the equivalent of typing the file's contents directly into the repl.
There is also ^C^K which the slime menu describes as compile/load
file.

Annoyingingly, emacs claims "C-c C-k is undefined" when I ask the help
system about that binding.

In any event, I'm not quite sure what "compile" means in this
context.  Is this truly "AOT compile into class files", or is it
something more general?  I suspect it's the latter; I don't see class
files being generated anywhere.  If the file I'm "compiling" contains
no errors, the effect seems to be just like ^C^L except that the
minibuffer says something like "Compilation finished: 0 errors  0
warnings  0 notes [0.00 secs]"  Is there any important difference
between the two here?

If there are errors, e.g., an intentional typo, other strangeness
occurs.  I'll get a message like "Compilation failed: 2 errors  0
warnings  0 notes [0.00 secs]".  Fine. From the file.clj buffer, I
think I should be able to use M-n and M-p to navigate amongst the
errors (or is it the notes?) but I only get "No next note."

If I then go to the *SLIME Compilation* buffer, I'll see something
like this:

2 compiler notes:
error:
java.lang.Exception: Unable to resolve symbol: greeto in this context
(hi.clj:3)
error:
java.lang.Exception: Unable to resolve symbol: greeto in this context


I'm not sure why the same error is appearing twice, but the first
instance even has the correct source code filename and line number. I
try to navigate from here by pressing enter.  No matter what line I'm
on when I press enter, emacs says "No error here".  Huh?

If, instead, I load the file with the typo with ^C^L I get a new
buffer in sldb mode, as shown below:

java.lang.Exception: Unable to resolve symbol: greeto in this context
(hi.clj:3)
  [Thrown class clojure.lang.Compiler$CompilerException]

Restarts:
 0: [ABORT] Return to SLIME's top level.
 1: [CAUSE] Throw cause of this exception

Backtrace:
  0: clojure.lang.Compiler.analyze(Compiler.java:4340)
  1: clojure.lang.Compiler.analyze(Compiler.java:4286)
  ... etc ...

Clearly this is a debugger.  I won't ask for details as to what I can
do here, except for this:  Typing 0 will get me back to the repl.
Fine.  However, Typing 1 will "Throw cause of this exception".  What
exactly does that mean?  Is it rethrowing the same exception, or doing
something different?  How is it useful?

Thanks to anyone who can help me with any of these issues.

   Mike

-- 
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