From: Dan Bensen
Subject: forgetting, closing, and slime-macro-expand
Date: 
Message-ID: <ediekc$2tv$1@wildfire.prairienet.org>
Three questions about Slime and the repl:

1.  In the repl, how do you say "undefine everything defined so far" so 
you can reload a file without getting a bunch of "already defined" messages?

2.  Inside the file you're loading, how do you say "stop reading and 
close this file" so you can go back to the repl and debug everything up 
to that point without having to comment out everything after that?

3.  In Slime, C-c C-m isn't working.  It just echoes the macro name, it 
doesn't echo any expansion.  What's the magic word that makes it work?

-- 
My name is dsb, and I'm at prairienet, which is an O-R-G.

From: D Herring
Subject: Re: forgetting, closing, and slime-macro-expand
Date: 
Message-ID: <pZGdnXlaVqYgfWHZnZ2dnUVZ_oWdnZ2d@comcast.com>
Dan Bensen wrote:
> Three questions about Slime and the repl:
> 
> 1.  In the repl, how do you say "undefine everything defined so far" so 
> you can reload a file without getting a bunch of "already defined" 
> messages?

The only perfect way is

CL-USER> (quit)
M-X slime

This gives you a completely new lisp session.  Note that doing so 
doesn't lose your history or close any buffers.

> 2.  Inside the file you're loading, how do you say "stop reading and 
> close this file" so you can go back to the repl and debug everything up 
> to that point without having to comment out everything after that?

Insert an (abort) at the point where you want execution to halt.

> 3.  In Slime, C-c C-m isn't working.  It just echoes the macro name, it 
> doesn't echo any expansion.  What's the magic word that makes it work?

Are you placing the cursor (point) on the closing parenthesis for the 
entire macro expression before pressing C-c C-m ?

- Daniel
From: Timofei Shatrov
Subject: Re: forgetting, closing, and slime-macro-expand
Date: 
Message-ID: <44fd1470.2662919@news.readfreenews.net>
On Mon, 04 Sep 2006 22:31:03 -0500, D Herring
<········@at.tentpost.dot.com> tried to confuse everyone with this
message:

>Dan Bensen wrote:
>> Three questions about Slime and the repl:
>> 
>> 1.  In the repl, how do you say "undefine everything defined so far" so 
>> you can reload a file without getting a bunch of "already defined" 
>> messages?
>
>The only perfect way is
>
>CL-USER> (quit)
>M-X slime
>
>This gives you a completely new lisp session.  Note that doing so 
>doesn't lose your history or close any buffers.

Someone posted a ",rest" shortcut a while ago. If you type that in the
REPL, Slime will restart underlying Lisp.

>> 2.  Inside the file you're loading, how do you say "stop reading and 
>> close this file" so you can go back to the repl and debug everything up 
>> to that point without having to comment out everything after that?
>
>Insert an (abort) at the point where you want execution to halt.
>
>> 3.  In Slime, C-c C-m isn't working.  It just echoes the macro name, it 
>> doesn't echo any expansion.  What's the magic word that makes it work?
>
>Are you placing the cursor (point) on the closing parenthesis for the 
>entire macro expression before pressing C-c C-m ?

Hmm, I tend to put the cursor at the opening parenthesis. I think that's
where you end up after pressing C-M-u. 

-- 
|Don't believe this - you're not worthless              ,gr---------.ru
|It's us against millions and we can't take them all... |  ue     il   |
|But we can take them on!                               |     @ma      |
|                       (A Wilhelm Scream - The Rip)    |______________|
From: Dan Bensen
Subject: Re: forgetting, closing, and slime-macro-expand
Date: 
Message-ID: <edk4b0$jse$1@wildfire.prairienet.org>
D Herring wrote:

 >> 1.  In the repl, how do you say "undefine everything defined so far"
 > The only perfect way is
 > CL-USER> (quit)
 > M-X slime

Is (quit) supposed to stop the repl in Slime?
It says "Evaluation aborted", but sbcl keeps running.
Also, this question is about the regular repl without Slime.

 >> 2.  Inside the file you're loading, how do you say
 >> "stop reading and close this file"
 > Insert an (abort) at the point where you want execution to halt.

Thank you, that seems to work.

 >> 3.  In Slime, C-c C-m isn't working.

 > Are you placing the cursor (point) on the closing parenthesis for the
 > entire macro expression before pressing C-c C-m ?

No, I wasn't.

Timofei Shatrov wrote:
 > Hmm, I tend to put the cursor at the opening parenthesis.

That's much easier.

-- 
My name is dsb, and I'm at prairienet, which is an O-R-G.
From: Bill Atkins
Subject: Re: forgetting, closing, and slime-macro-expand
Date: 
Message-ID: <m2y7syi8p2.fsf@machamp-218.dynamic.rpi.edu>
Dan Bensen <··········@cyberspace.net> writes:

> D Herring wrote:
>
>>> 1.  In the repl, how do you say "undefine everything defined so far"

This is pretty tricky to do.  Generally, you're better off just
restarting the image.  In SLIME, this is done with
,restart-inferior-lisp .  At the "regular REPL", just (quit) and then
start again.

It is sometimes possible to get this behavior by deleting packages.
For instance, if you loaded packages called FOO and BAR, calling
(delete-package "FOO") will make all of its symbols eligible for
garbage collection and now you can reload whatever code defines the
functions and variables in FOO.  If you have other packages that are
using FOO, though, this could cause problems.

Although this is a common question here, the need for this doesn't
actually come up very often.  If you're using ASDF, just restart your
Lisp image and reload the ASDF system you're working on and you should
be mostly back where you started.  If that's not enough, just restart
the image.

>>> 2.  Inside the file you're loading, how do you say
>>> "stop reading and close this file"
>> Insert an (abort) at the point where you want execution to halt.
>
> Thank you, that seems to work.
>
>>> 3.  In Slime, C-c C-m isn't working.
>
>> Are you placing the cursor (point) on the closing parenthesis for the
>> entire macro expression before pressing C-c C-m ?
>
> No, I wasn't.

Are you sure the form is a macro?  Can you post the text of the form?

HTH,
Bill Atkins
From: Dan Bensen
Subject: Re: forgetting, closing, and slime-macro-expand
Date: 
Message-ID: <edk7n1$kvp$1@wildfire.prairienet.org>
Dan Bensen wrote:
> Three questions about Slime and the repl:

Question 4:
In Slime, how do you expand a macro defined by MACROLET?
The function containing it isn't compiling,
and the error is somewhere in the macro.

-- 
My name is dsb, and I'm at prairienet, which is an O-R-G.
From: Bill Atkins
Subject: Re: forgetting, closing, and slime-macro-expand
Date: 
Message-ID: <m2odtui8hk.fsf@machamp-218.dynamic.rpi.edu>
Dan Bensen <··········@cyberspace.net> writes:

> Dan Bensen wrote:
>> Three questions about Slime and the repl:
>
> Question 4:
> In Slime, how do you expand a macro defined by MACROLET?
> The function containing it isn't compiling,
> and the error is somewhere in the macro.

I'm not aware of any way of doing this, but you can certainly move it
out into a DEFMACRO to test it out and then put it back where it came
from.

For this very reason (i.e. the difficulty of debugging), I prefer
DEFMACRO to MACROLET except for very, very simple macros.

Bill Atkins
From: Juho Snellman
Subject: Re: forgetting, closing, and slime-macro-expand
Date: 
Message-ID: <slrnefrbcq.7i8.jsnell@sbz-30.cs.Helsinki.FI>
Dan Bensen <··········@cyberspace.net> wrote:
> Dan Bensen wrote:
>> Three questions about Slime and the repl:
>
> Question 4:
> In Slime, how do you expand a macro defined by MACROLET?
> The function containing it isn't compiling,
> and the error is somewhere in the macro.

Use slime-macroexpand-all (C-C M-M). For example with:

(defun foo (z)
  (macrolet ((a (x)
               `(print ,x)))
    (macrolet ((b (x)
                 `(a (1+ ,x))))
      (b (a z)))))

Put the point on the opening paren before the first MACROLET. Then C-C
M-M, and the macroexpansion buffer should pop up with:

(MACROLET ((A (X)
             `(PRINT ,X)))
  (MACROLET ((B (X)
               `(A (1+ ,X))))
    (PRINT (1+ (PRINT Z)))))

-- 
Juho Snellman
From: Ivan Boldyrev
Subject: Re: forgetting, closing, and slime-macro-expand
Date: 
Message-ID: <5cm0t3-oei.ln1@ibhome.cgitftp.uiggm.nsc.ru>
On 9588 day of my life Dan Bensen wrote:
> Three questions about Slime and the repl:
>
> 1.  In the repl, how do you say "undefine everything defined so far"
> so you can reload a file without getting a bunch of "already defined"
> messages?

Switch to SLIME REPL, type `,' (single comma) and type command
restart-inferior-lisp RET

> 3.  In Slime, C-c C-m isn't working.  It just echoes the macro name,
> it doesn't echo any expansion.  What's the magic word that makes it
> work?

Move cursor to proper position

(my-macro bla-bla-bla)
^
Here

-- 
Ivan Boldyrev

              "Assembly of Japanese bicycle require great peace of mind."