From: BobF
Subject: (reset-cluser)
Date: 
Message-ID: <1m6qkzu7rze8$.1uv2r7hv5wzfz$.dlg@40tude.net>
For those that haven't grown tired of this yet ...

I'm starting a new thread to cleanly present what I'm getting.  All code
presented is directly copy/pasted.

My environment is lispbox; clisp 2.37 w/slime.  I'm using split windows,
with slime-repl in the top window and reset.lisp in the bottom window.

Starting with this (provided by PB):
-----
(defun reset-cluser ()
  "Delete the COMMON-LISP-USER package and makes a new one."
  (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
    (let ((*package* (find-package "COMMON-LISP")))
      (delete-package "COMMON-LISP-USER")
      (defpackage "COMMON-LISP-USER"
        (:nicknames "CL-USER")
        (:use "COMMON-LISP" "COM.INFORMATIMAGO.PJB")))
    (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
-----

I deleted "COM.INFORMATIMAGO.PJB" to get this:
-----
(defun reset-cluser ()
  "Delete the COMMON-LISP-USER package and makes a new one."
  (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
    (let ((*package* (find-package "COMMON-LISP")))
      (delete-package "COMMON-LISP-USER")
      (defpackage "COMMON-LISP-USER"
        (:nicknames "CL-USER")
        (:use "COMMON-LISP")))
    (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
-----

which I entered into a source file called reset.lisp.  From the reset.lisp
buffer, I execute C-c C-k to compile/load reset.lisp.  

repl displays:
-----
; SLIME 2005-12-27
;;;; Compile file x:/lispbox-0.7-clisp-2.37/lispbox-0.7/src/reset ...
;; Compiling file X:\lispbox-0.7-clisp-2.37\lispbox-0.7\src\reset.lisp ...
;; Wrote file X:\lispbox-0.7-clisp-2.37\lispbox-0.7\src\reset.fas
;; Loading file X:\lispbox-0.7-clisp-2.37\lispbox-0.7\src\reset.fas ...
;; Loaded file X:\lispbox-0.7-clisp-2.37\lispbox-0.7\src\reset.fas
0 errors, 0 warnings

CL-USER> 
-----

Next, I enter (reset-cluser) and repl replies:
-----
CL-USER> (reset-cluser)
#<PACKAGE COMMON-LISP-USER>
CL-USER>
-----

Looks good so far, right?
Next, I start entering a (load) form.  When I hit the space-bar following
(load
-----
CL-USER> (load 
-----

sldb pops into the lower window with:
-----
The value of *PACKAGE* was not a package and was reset. The old value was
#1=#<DELETED PACKAGE
     COMMON-LISP-USER>. The new value is #<PACKAGE COMMON-LISP>.
   [Condition of type SIMPLE-TYPE-ERROR]

Restarts:
  0: [CONTINUE] Proceed with the new value.
  1: [ABORT-REQUEST] Abort handling SLIME request.
  2: [ABORT] Return to SLIME top-level.
  3: [ABORT] ABORT
.
.
.
-----

If I choose '0' to continue, I am able to load another lisp file and all
appearances are that everything is normal ...  

(( although I am trouble by the fact that I appear to now be "in" package
COMMON-LISP instead of COMMON_LISP_USER, which is probably the reason for
the next error ))

... until I attempt to load reset.lisp again:
-----
INTERN("RESET-CLUSER"): #1=#<PACKAGE COMMON-LISP> is locked
   [Condition of type SYSTEM::SIMPLE-PACKAGE-ERROR]

Restarts:
  0: [CONTINUE] Ignore the lock and proceed
  1: [ABORT] Abort SLIME compilation.
  2: [ABORT-REQUEST] Abort handling SLIME request.
  3: [ABORT] Return to SLIME top-level.
  4: [ABORT] ABORT
.
.
.
-----

From: Ron Garret
Subject: Re: (reset-cluser)
Date: 
Message-ID: <rNOSPAMon-A893D3.09053409062006@news.gha.chartermi.net>
In article <································@40tude.net>,
 BobF <··@thanks.net> wrote:

> For those that haven't grown tired of this yet ...
> 
> I'm starting a new thread to cleanly present what I'm getting.  All code
> presented is directly copy/pasted.
> 
> My environment is lispbox; clisp 2.37 w/slime.  I'm using split windows,
> with slime-repl in the top window and reset.lisp in the bottom window.
> 
> Starting with this (provided by PB):
> -----
> (defun reset-cluser ()
>   "Delete the COMMON-LISP-USER package and makes a new one."
>   (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
>     (let ((*package* (find-package "COMMON-LISP")))
>       (delete-package "COMMON-LISP-USER")
>       (defpackage "COMMON-LISP-USER"
>         (:nicknames "CL-USER")
>         (:use "COMMON-LISP" "COM.INFORMATIMAGO.PJB")))
>     (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
> -----
> 
> I deleted "COM.INFORMATIMAGO.PJB" to get this:
> -----
> (defun reset-cluser ()
>   "Delete the COMMON-LISP-USER package and makes a new one."
>   (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
>     (let ((*package* (find-package "COMMON-LISP")))
>       (delete-package "COMMON-LISP-USER")
>       (defpackage "COMMON-LISP-USER"
>         (:nicknames "CL-USER")
>         (:use "COMMON-LISP")))
>     (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
> -----
> 
> which I entered into a source file called reset.lisp.

I believe if you look very closely at what you have in reset.lisp you 
will find it differs slightly but significantly from what you have above.

rg
From: BobF
Subject: Re: (reset-cluser)
Date: 
Message-ID: <sw4ys8vv3ava$.hspnlt3kwsrq.dlg@40tude.net>
On Fri, 09 Jun 2006 09:05:34 -0700, Ron Garret wrote:

> In article <································@40tude.net>,
>  BobF <··@thanks.net> wrote:
> 
>> For those that haven't grown tired of this yet ...
>> 
>> I'm starting a new thread to cleanly present what I'm getting.  All code
>> presented is directly copy/pasted.
>> 
>> My environment is lispbox; clisp 2.37 w/slime.  I'm using split windows,
>> with slime-repl in the top window and reset.lisp in the bottom window.
>> 
>> Starting with this (provided by PB):
>> -----
>> (defun reset-cluser ()
>>   "Delete the COMMON-LISP-USER package and makes a new one."
>>   (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
>>     (let ((*package* (find-package "COMMON-LISP")))
>>       (delete-package "COMMON-LISP-USER")
>>       (defpackage "COMMON-LISP-USER"
>>         (:nicknames "CL-USER")
>>         (:use "COMMON-LISP" "COM.INFORMATIMAGO.PJB")))
>>     (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
>> -----
>> 
>> I deleted "COM.INFORMATIMAGO.PJB" to get this:
>> -----
>> (defun reset-cluser ()
>>   "Delete the COMMON-LISP-USER package and makes a new one."
>>   (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
>>     (let ((*package* (find-package "COMMON-LISP")))
>>       (delete-package "COMMON-LISP-USER")
>>       (defpackage "COMMON-LISP-USER"
>>         (:nicknames "CL-USER")
>>         (:use "COMMON-LISP")))
>>     (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
>> -----
>> 
>> which I entered into a source file called reset.lisp.
> 
> I believe if you look very closely at what you have in reset.lisp you 
> will find it differs slightly but significantly from what you have above.
> 
> rg

The above was copy/pasted from reset.lisp ...

here's another copy:

(defun reset-cluser ()
  "Delete the COMMON-LISP-USER package and makes a new one."
  (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
    (let ((*package* (find-package "COMMON-LISP")))
      (delete-package "COMMON-LISP-USER")
      (defpackage "COMMON-LISP-USER"
        (:nicknames "CL-USER")
        (:use "COMMON-LISP")))
    (when setp (setf *package* (find-package "COMMON-LISP-USER")))))

Beats me.  I've stared and gone character-by-character so many times I'm
almost blind.

I give up.  I have an ILC paper to write and I'm sure you have better
things to do, so this is really a waste of our collective time.
From: Ron Garret
Subject: Re: (reset-cluser)
Date: 
Message-ID: <rNOSPAMon-98D759.10091809062006@news.gha.chartermi.net>
In article <······························@40tude.net>,
 BobF <··@thanks.net> wrote:

> On Fri, 09 Jun 2006 09:05:34 -0700, Ron Garret wrote:
> 
> > In article <································@40tude.net>,
> >  BobF <··@thanks.net> wrote:
> > 
> >> For those that haven't grown tired of this yet ...
> >> 
> >> I'm starting a new thread to cleanly present what I'm getting.  All code
> >> presented is directly copy/pasted.
> >> 
> >> My environment is lispbox; clisp 2.37 w/slime.  I'm using split windows,
> >> with slime-repl in the top window and reset.lisp in the bottom window.
> >> 
> >> Starting with this (provided by PB):
> >> -----
> >> (defun reset-cluser ()
> >>   "Delete the COMMON-LISP-USER package and makes a new one."
> >>   (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
> >>     (let ((*package* (find-package "COMMON-LISP")))
> >>       (delete-package "COMMON-LISP-USER")
> >>       (defpackage "COMMON-LISP-USER"
> >>         (:nicknames "CL-USER")
> >>         (:use "COMMON-LISP" "COM.INFORMATIMAGO.PJB")))
> >>     (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
> >> -----
> >> 
> >> I deleted "COM.INFORMATIMAGO.PJB" to get this:
> >> -----
> >> (defun reset-cluser ()
> >>   "Delete the COMMON-LISP-USER package and makes a new one."
> >>   (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
> >>     (let ((*package* (find-package "COMMON-LISP")))
> >>       (delete-package "COMMON-LISP-USER")
> >>       (defpackage "COMMON-LISP-USER"
> >>         (:nicknames "CL-USER")
> >>         (:use "COMMON-LISP")))
> >>     (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
> >> -----
> >> 
> >> which I entered into a source file called reset.lisp.
> > 
> > I believe if you look very closely at what you have in reset.lisp you 
> > will find it differs slightly but significantly from what you have above.
> > 
> > rg
> 
> The above was copy/pasted from reset.lisp ...
> 
> here's another copy:
> 
> (defun reset-cluser ()
>   "Delete the COMMON-LISP-USER package and makes a new one."
>   (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
>     (let ((*package* (find-package "COMMON-LISP")))
>       (delete-package "COMMON-LISP-USER")
>       (defpackage "COMMON-LISP-USER"
>         (:nicknames "CL-USER")
>         (:use "COMMON-LISP")))
>     (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
> 
> Beats me.  I've stared and gone character-by-character so many times I'm
> almost blind.
> 
> I give up.  I have an ILC paper to write and I'm sure you have better
> things to do, so this is really a waste of our collective time.

Well, that's pretty weird.  I was able to reproduce the problem from a 
version that you pasted into the other thread.  That version had a 
misplaced parenthesis, but I gather you figured that out already.

This version works fine for me.  In any case, you probably ought not 
spend too much time trying to figure this out.  If you really must reset 
your environment just stop Lisp and restart it.  Or use the 
reset-current-package function that I posted in the other thread.

rg
From: Don Geddis
Subject: Re: (reset-cluser)
Date: 
Message-ID: <8764jaqkkh.fsf@geddis.org>
> In article <······························@40tude.net>, BobF <··@thanks.net> wrote:
>> >> Starting with this (provided by PB):
>> >> I deleted "COM.INFORMATIMAGO.PJB" to get this:
>> >> which I entered into a source file called reset.lisp.

Ron Garret <·········@flownet.com> wrote on Fri, 09 Jun 2006:
>> > I believe if you look very closely at what you have in reset.lisp you 
>> > will find it differs slightly but significantly from what you have above.

BobF wrote:
>> The above was copy/pasted from reset.lisp ...
>> here's another copy:
>> Beats me.  I've stared and gone character-by-character so many times I'm
>> almost blind.

Ron wrote:
> Well, that's pretty weird.  I was able to reproduce the problem from a 
> version that you pasted into the other thread.  That version had a 
> misplaced parenthesis, but I gather you figured that out already.
> This version works fine for me.

When I've had bizarre problems like this in the past, it's often because
I'm loading and old compiled file, but looking at new source code.

Sounds like BobF used to have source code which would evaluate just like
we're seeing in traces, and believes he's now changed it.  I suspect he's
still running the old code.

Try the usual things: Remove all *.fas files from your directory, quit your
lisp (and slime and emacs), start a new (emacs, slime) lisp, and try again
from scratch.

Your trace does look like it's recompiling the source code, so my guess may
be wrong.  But your symptoms are awfully suspicious, and it's sometimes hard
to tell just where code comes from that you execute.

        -- Don
_______________________________________________________________________________
Don Geddis                  http://don.geddis.org/               ···@geddis.org
Crush your enemies, see them driven before you, see their severed heads
lying at your feet, take their horses and goods, and hear the lamentations of
their women.  -- Genghis Khan, on the meaning of life
From: BobF
Subject: Re: (reset-cluser)
Date: 
Message-ID: <109umw4tnbiy4$.1xoqutgz7i0xj.dlg@40tude.net>
On Fri, 09 Jun 2006 10:56:46 -0700, Don Geddis wrote:

> 
> When I've had bizarre problems like this in the past, it's often because
> I'm loading and old compiled file, but looking at new source code.
> 
> Sounds like BobF used to have source code which would evaluate just like
> we're seeing in traces, and believes he's now changed it.  I suspect he's
> still running the old code.
> 
> Try the usual things: Remove all *.fas files from your directory, quit your
> lisp (and slime and emacs), start a new (emacs, slime) lisp, and try again
> from scratch.
> 
> Your trace does look like it's recompiling the source code, so my guess may
> be wrong.  But your symptoms are awfully suspicious, and it's sometimes hard
> to tell just where code comes from that you execute.
> 
>         -- Don

Thanks for the suggestion, Don.  I did have a reset.fas file, but deleting
it made no difference in the results.
From: BobF
Subject: Re: (reset-cluser)
Date: 
Message-ID: <1a0t24dyrug00$.1in54ktkhmqwv.dlg@40tude.net>
On Fri, 09 Jun 2006 10:09:18 -0700, Ron Garret wrote:
> 
> This version works fine for me.  In any case, you probably ought not 
> spend too much time trying to figure this out.  If you really must reset 
> your environment just stop Lisp and restart it.  Or use the 
> reset-current-package function that I posted in the other thread.
> 
> rg

When you say this version works, are you doing anything after
(reset-cluser)?

With this version, I don't see a problem until I attempt to (load
"something").

Anyway, thanks for testing.  ",rest RET" is the answer to the question I
originally asked.

Back to building that CD database :-)
From: Ron Garret
Subject: Re: (reset-cluser)
Date: 
Message-ID: <rNOSPAMon-499D50.16392311062006@news.gha.chartermi.net>
In article <································@40tude.net>,
 BobF <··@thanks.net> wrote:

> On Fri, 09 Jun 2006 10:09:18 -0700, Ron Garret wrote:
> > 
> > This version works fine for me.  In any case, you probably ought not 
> > spend too much time trying to figure this out.  If you really must reset 
> > your environment just stop Lisp and restart it.  Or use the 
> > reset-current-package function that I posted in the other thread.
> > 
> > rg
> 
> When you say this version works, are you doing anything after
> (reset-cluser)?
> 
> With this version, I don't see a problem until I attempt to (load
> "something").
> 
> Anyway, thanks for testing.  ",rest RET" is the answer to the question I
> originally asked.
> 
> Back to building that CD database :-)

[···@Mini:~]$ cat foo.lisp
(defun reset-cluser ()
  "Delete the COMMON-LISP-USER package and makes a new one."
  (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
    (let ((*package* (find-package "COMMON-LISP")))
      (delete-package "COMMON-LISP-USER")
      (defpackage "COMMON-LISP-USER"
        (:nicknames "CL-USER")
        (:use "COMMON-LISP")))
    (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
[···@Mini:~]$ devel/clisp-2.38/standard-build/clisp
  i i i i i i i       ooooo    o        ooooooo   ooooo   ooooo
  I I I I I I I      8     8   8           8     8     o  8    8
  I  \ `+' /  I      8         8           8     8        8    8
   \  `-+-'  /       8         8           8      ooooo   8oooo
    `-__|__-'        8         8           8           8  8
        |            8     o   8           8     o     8  8
  ------+------       ooooo    8oooooo  ooo8ooo   ooooo   8

Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2006

[1]> (load "foo")
;; Loading file /Users/ron/foo.lisp ...
;; Loaded file /Users/ron/foo.lisp
T
[2]> (reset-cluser)
#<PACKAGE COMMON-LISP-USER>
CL-USER[3]> (load "foo")
;; Loading file /Users/ron/foo.lisp ...
;; Loaded file /Users/ron/foo.lisp
T
CL-USER[4]> (reset-cluser)
#<PACKAGE COMMON-LISP-USER>
CL-USER[5]> (load "foo")
;; Loading file /Users/ron/foo.lisp ...
;; Loaded file /Users/ron/foo.lisp
T
CL-USER[6]> 
Bye.


But I think someone else mentioned it is in fact a Slime thing.  I don't 
use Slime.

rg
From: BobF
Subject: Re: (reset-cluser)
Date: 
Message-ID: <1e3pfxamswcx7$.188fqhjikc70j.dlg@40tude.net>
On Sun, 11 Jun 2006 16:39:23 -0700, Ron Garret wrote:

> 
> But I think someone else mentioned it is in fact a Slime thing.  I don't 
> use Slime.
> 
> rg

Thanks, Ron.  I have this filed away for future use when I'm not using 
slime.
From: Ken Tilton
Subject: Re: (reset-cluser)
Date: 
Message-ID: <Dbjig.158$uk5.157@fe12.lga>
BobF wrote:
> I give up.  I have an ILC paper to write ...

PWUAHAHAHAH... I actually spent a full ten seconds trying to figure out 
what a newby would be doing writing an ILC paper (when the next ILC is 
not until 2010 or something).

Good one. :)

kenzo

-- 
Cells: http://common-lisp.net/project/cells/

"I'll say I'm losing my grip, and it feels terrific."
    -- Smiling husband to scowling wife, New Yorker cartoon
From: Pascal Costanza
Subject: Re: (reset-cluser)
Date: 
Message-ID: <4eu10rF1f0pakU2@individual.net>
Ken Tilton wrote:
> 
> 
> BobF wrote:
>> I give up.  I have an ILC paper to write ...
> 
> PWUAHAHAHAH... I actually spent a full ten seconds trying to figure out 
> what a newby would be doing writing an ILC paper (when the next ILC is 
> not until 2010 or something).

Have you googled for "ILC"?


Pascal

-- 
3rd European Lisp Workshop
July 3 - Nantes, France - co-located with ECOOP 2006
http://lisp-ecoop06.bknr.net/
From: ·········@juno.com
Subject: Re: (reset-cluser)
Date: 
Message-ID: <1150133476.939285.174520@g10g2000cwb.googlegroups.com>
BobF wrote:
> On Fri, 09 Jun 2006 09:05:34 -0700, Ron Garret wrote:
>
> > In article <································@40tude.net>,
> >  BobF <··@thanks.net> wrote:
> >
> >> For those that haven't grown tired of this yet ...
> >>
> >> I'm starting a new thread to cleanly present what I'm getting.  All code
> >> presented is directly copy/pasted.
> >>
> >> My environment is lispbox; clisp 2.37 w/slime.  I'm using split windows,
> >> with slime-repl in the top window and reset.lisp in the bottom window.
> >>
> >> Starting with this (provided by PB):
> >> -----
> >> (defun reset-cluser ()
> >>   "Delete the COMMON-LISP-USER package and makes a new one."
> >>   (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
> >>     (let ((*package* (find-package "COMMON-LISP")))
> >>       (delete-package "COMMON-LISP-USER")
> >>       (defpackage "COMMON-LISP-USER"
> >>         (:nicknames "CL-USER")
> >>         (:use "COMMON-LISP" "COM.INFORMATIMAGO.PJB")))
> >>     (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
> >> -----
> >>
> >> I deleted "COM.INFORMATIMAGO.PJB" to get this:
> >> -----
> >> (defun reset-cluser ()
> >>   "Delete the COMMON-LISP-USER package and makes a new one."
> >>   (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
> >>     (let ((*package* (find-package "COMMON-LISP")))
> >>       (delete-package "COMMON-LISP-USER")
> >>       (defpackage "COMMON-LISP-USER"
> >>         (:nicknames "CL-USER")
> >>         (:use "COMMON-LISP")))
> >>     (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
> >> -----
> >>
> >> which I entered into a source file called reset.lisp.
> >
> > I believe if you look very closely at what you have in reset.lisp you
> > will find it differs slightly but significantly from what you have above.
> >
> > rg
>
> The above was copy/pasted from reset.lisp ...
>
> here's another copy:
>
> (defun reset-cluser ()
>   "Delete the COMMON-LISP-USER package and makes a new one."
>   (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
>     (let ((*package* (find-package "COMMON-LISP")))
>       (delete-package "COMMON-LISP-USER")
>       (defpackage "COMMON-LISP-USER"
>         (:nicknames "CL-USER")
>         (:use "COMMON-LISP")))
>     (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
>
> Beats me.  I've stared and gone character-by-character so many times I'm
> almost blind.
>
> I give up.  I have an ILC paper to write and I'm sure you have better
> things to do, so this is really a waste of our collective time.

Running in recent clisp suggests that reset-cluser may not delete all
your files
but it still isn't leaving you in a good initialized state.

[2]> (reset-cluser)
#<PACKAGE COMMON-LISP-USER>
CL-USER[3]> (quit)

*** - EVAL: undefined function QUIT
The following restarts are available:
USE-VALUE      :R1      You may input a value to be used instead of
(FDEFINITION 'QUIT).
RETRY          :R2      Retry
STORE-VALUE    :R3      You may input a new value for (FDEFINITION
'QUIT).
ABORT          :R4      ABORT
From: Luís Oliveira
Subject: Re: (reset-cluser)
Date: 
Message-ID: <m2ac8imfso.fsf@deadspam.com>
·········@juno.com writes:
> [2]> (reset-cluser)
> #<PACKAGE COMMON-LISP-USER>
> CL-USER[3]> (quit)
>
> *** - EVAL: undefined function QUIT

Since the newly created CL-USER only imports the COMMON-LISP package, it
won't have QUIT which, in CLISP, belongs to the EXT package. Try calling
(ext:quit) instead.

-- 
Luís Oliveira
luismbo (@) gmail (.) com
http://student.dei.uc.pt/~lmoliv/
From: Pisin Bootvong
Subject: Re: (reset-cluser)
Date: 
Message-ID: <1150136180.545838.91580@f6g2000cwb.googlegroups.com>
Luís Oliveira เขียน:
> ·········@juno.com writes:
> > [2]> (reset-cluser)
> > #<PACKAGE COMMON-LISP-USER>
> > CL-USER[3]> (quit)
> >
> > *** - EVAL: undefined function QUIT
>
> Since the newly created CL-USER only imports the COMMON-LISP package, it
> won't have QUIT which, in CLISP, belongs to the EXT package. Try calling
> (ext:quit) instead.
>

If CL-USER was never polluted by (use-package) then one can save
package-use-list for using when recreating a new package.

Or make it two steps process, one call to (save-package-state) to save
(package-use-list), and, if possible exported symbols list.

Then another step (reset-package) to recreate the new package according
to properties previously saved.

But then again, SLIME ",rest" is easier to use :-D


> --
> Luís Oliveira
> luismbo (@) gmail (.) com
> http://student.dei.uc.pt/~lmoliv/
From: ·········@juno.com
Subject: Re: (reset-cluser)
Date: 
Message-ID: <1150141215.122270.224300@y43g2000cwc.googlegroups.com>
Luís Oliveira wrote:
> ·········@juno.com writes:
> > [2]> (reset-cluser)
> > #<PACKAGE COMMON-LISP-USER>
> > CL-USER[3]> (quit)
> >
> > *** - EVAL: undefined function QUIT
>
> Since the newly created CL-USER only imports the COMMON-LISP package, it
> won't have QUIT which, in CLISP, belongs to the EXT package. Try calling
> (ext:quit) instead.
>
> --
> Luís Oliveira
> luismbo (@) gmail (.) com
> http://student.dei.uc.pt/~lmoliv/


I could just do:

(use-package 'ext)

The goal is to restore the initial state of clisp, which this still
doesn't do.
From: Pascal Bourguignon
Subject: Re: (reset-cluser)
Date: 
Message-ID: <87ver5z70j.fsf@thalassa.informatimago.com>
·········@juno.com writes:

> Lu�s Oliveira wrote:
>> ·········@juno.com writes:
>> > [2]> (reset-cluser)
>> > #<PACKAGE COMMON-LISP-USER>
>> > CL-USER[3]> (quit)
>> >
>> > *** - EVAL: undefined function QUIT
>>
>> Since the newly created CL-USER only imports the COMMON-LISP package, it
>> won't have QUIT which, in CLISP, belongs to the EXT package. Try calling
>> (ext:quit) instead.
>>
>> --
>> Lu�s Oliveira
>> luismbo (@) gmail (.) com
>> http://student.dei.uc.pt/~lmoliv/
>
>
> I could just do:
>
> (use-package 'ext)
>
> The goal is to restore the initial state of clisp, which this still
> doesn't do.

I don't do clisp. I do Common Lisp.  
Even if my favorite implementation is clisp.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

"What is this talk of "release"?  Klingons do not make software
"releases".  Our software "escapes" leaving a bloody trail of
designers and quality assurance people in its wake."
From: Pascal Bourguignon
Subject: A new version of (reset-cluser)
Date: 
Message-ID: <874pyq1c1p.fsf_-_@thalassa.informatimago.com>
·············@deadspam.com (Lu�s Oliveira) writes:

> ·········@juno.com writes:
>> [2]> (reset-cluser)
>> #<PACKAGE COMMON-LISP-USER>
>> CL-USER[3]> (quit)
>>
>> *** - EVAL: undefined function QUIT
>
> Since the newly created CL-USER only imports the COMMON-LISP package, it
> won't have QUIT which, in CLISP, belongs to the EXT package. Try calling
> (ext:quit) instead.


Following the fiasco of RESET-CLUSER, here is a new version that
should give better results:

------------------------------------------------------------------------

(defpackage "RESET" (:use "COMMON-LISP") (:export "RESET-CLUSER"))
(in-package "RESET")

(defvar *user-packages* '())

(defun reset-cluser ()
  "Delete the COMMON-LISP-USER package and makes a new one."
  (when (find-package "SWANK")
     (error "RESET-CLUSER doesn't work with slime, use a slime command!"))
  (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
    (let ((*package* (find-package "COMMON-LISP")))
      (delete-package "COMMON-LISP-USER")
      (make-package "COMMON-LISP-USER" 
                    :nicknames '("CL-USER")
                    :use (cons "COMMON-LISP" *user-packages*)))
    (when setp (setf *package* (find-package "COMMON-LISP-USER")))))

------------------------------------------------------------------------

Instructions:

    1- load reset-cluser.lisp

    2- (setf reset:*user-packages* (quote
           #.(cl:progn (cl:format *query-io*
                             "Please, enter a _list_ of all the packages ~
                              you want by default in your cl-user package: ")
                       (cl:read *query-io* nil '())) ))

    3- (reset:reset-cluser)


On clisp, you could put this in ~/.clisprc:

    (defpackage "RESET" (:use "COMMON-LISP") (:export "RESET-CLUSER"))
    (in-package "RESET")

    (defparameter *user-packages* '("EXT"))
    ;;; But personnaly, I prefer to build a common environment in
    ;;; all the Common Lisp implementation I use, so I avoid to use
    ;;; implementation specific packages by default, hence my
    ;;; com.informatimago.pjb interactive functions package, that
    ;;; is the same for all the Common Lisp implementations I use.

    (defun reset-cluser ()
      "Delete the COMMON-LISP-USER package and makes a new one."
      (when (find-package "SWANK")
         (error "RESET-CLUSER doesn't work with slime, use a slime command!"))
      (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
        (let ((*package* (find-package "COMMON-LISP")))
          (delete-package "COMMON-LISP-USER")
          (make-package "COMMON-LISP-USER" 
                        :nicknames '("CL-USER")
                        :use (cons "COMMON-LISP" *user-packages*)))
        (when setp (setf *package* (find-package "COMMON-LISP-USER")))))

    (in-package "CL-USER")

    ;; ...


So now you can do:


CL-USER[72]> (reset::reset-cluser)
#<PACKAGE COMMON-LISP-USER>
CL-USER[73]> (defvar x 1)
X
CL-USER[74]> (boundp 'x)
T
CL-USER[75]> (reset::reset-cluser)
#<PACKAGE COMMON-LISP-USER>
CL-USER[76]> (boundp 'x)
NIL
CL-USER[77]> 


and in slime, you get a nice:
"RESET-CLUSER doesn't work with slime, use a slime command!" error.

CL-USER> (reset:reset-cluser)
; Evaluation aborted
CL-USER> 


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

HANDLE WITH EXTREME CARE: This product contains minute electrically
charged particles moving at velocities in excess of five hundred
million miles per hour.
From: BobF
Subject: Re: A new version of (reset-cluser)
Date: 
Message-ID: <tqoe8gbvvb9n.1v7o68a2qxf5w$.dlg@40tude.net>
On Mon, 12 Jun 2006 20:09:06 +0200, Pascal Bourguignon wrote:

> 
> and in slime, you get a nice:
> "RESET-CLUSER doesn't work with slime, use a slime command!" error.
> 
> CL-USER> (reset:reset-cluser)
> ; Evaluation aborted
> CL-USER>

<grin>  (saved for future reference when I graduate from slime)
From: Thomas A. Russ
Subject: Re: A new version of (reset-cluser)
Date: 
Message-ID: <ymiodwx9dpo.fsf@sevak.isi.edu>
Pascal Bourguignon <···@informatimago.com> writes:

> ·············@deadspam.com (Lu�s Oliveira) writes:
> 
> Following the fiasco of RESET-CLUSER, here is a new version that
> should give better results:
> 
> ------------------------------------------------------------------------
> 
> (defpackage "RESET" (:use "COMMON-LISP") (:export "RESET-CLUSER"))
> (in-package "RESET")
> 
> (defvar *user-packages* '())

Rather than having this be manually run like in the instructions below,
why not just initialize it when the code loads:

(defvar *user-packages* (package-use-list (find-package "COMMON-LISP-USER")))

Since the goal is to reset the common-lisp-user package to its original
state, that would seem to be the simplest solution.  It will also end up
getting all of the idiosyncratic implementation-dependent packages that
are used by CL-USER.

Of course, this does assume that one loads the reset-cluser code before
modifying the use list of the CL-USER package.


> (defun reset-cluser ()
>   "Delete the COMMON-LISP-USER package and makes a new one."
>   (when (find-package "SWANK")
>      (error "RESET-CLUSER doesn't work with slime, use a slime command!"))
>   (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
>     (let ((*package* (find-package "COMMON-LISP")))
>       (delete-package "COMMON-LISP-USER")
>       (make-package "COMMON-LISP-USER" 
>                     :nicknames '("CL-USER")
>                     :use (cons "COMMON-LISP" *user-packages*)))
>     (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
> 
> ------------------------------------------------------------------------
> 
> Instructions:
> 
>     1- load reset-cluser.lisp
> 
>     2- (setf reset:*user-packages* (quote
>            #.(cl:progn (cl:format *query-io*
>                              "Please, enter a _list_ of all the packages ~
>                               you want by default in your cl-user package: ")
>                        (cl:read *query-io* nil '())) ))
> 
>     3- (reset:reset-cluser)
> 
> 
> On clisp, you could put this in ~/.clisprc:

-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Pascal Bourguignon
Subject: Re: (reset-cluser)
Date: 
Message-ID: <871wty13bx.fsf@thalassa.informatimago.com>
BobF <··@thanks.net> writes:

> For those that haven't grown tired of this yet ...
>
> I'm starting a new thread to cleanly present what I'm getting.  All code
> presented is directly copy/pasted.
>
> My environment is lispbox; clisp 2.37 w/slime.  I'm using split windows,
> with slime-repl in the top window and reset.lisp in the bottom window.
> [...]
> I deleted "COM.INFORMATIMAGO.PJB" to get this:
> -----
> (defun reset-cluser ()
>   "Delete the COMMON-LISP-USER package and makes a new one."
>   (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
>     (let ((*package* (find-package "COMMON-LISP")))
>       (delete-package "COMMON-LISP-USER")
>       (defpackage "COMMON-LISP-USER"
>         (:nicknames "CL-USER")
>         (:use "COMMON-LISP")))
>     (when setp (setf *package* (find-package "COMMON-LISP-USER")))))
> -----
> [...]
> Next, I enter (reset-cluser) and repl replies:
> -----
> CL-USER> (reset-cluser)
> #<PACKAGE COMMON-LISP-USER>
> CL-USER>
> -----
>
> Looks good so far, right?
> Next, I start entering a (load) form.  When I hit the space-bar following
> (load
> -----
> CL-USER> (load 
> -----
>
> sldb pops into the lower window with:
> -----
> The value of *PACKAGE* was not a package and was reset. The old value was
> #1=#<DELETED PACKAGE
>      COMMON-LISP-USER>. The new value is #<PACKAGE COMMON-LISP>.
>    [Condition of type SIMPLE-TYPE-ERROR]
>
> Restarts:
>   0: [CONTINUE] Proceed with the new value.
>   1: [ABORT-REQUEST] Abort handling SLIME request.
>   2: [ABORT] Return to SLIME top-level.
>   3: [ABORT] ABORT

Well, swank is keeping references to the old package, in *package* and
in swank::*buffer-package*. The lisp code sent from emacs is evaluated
in swank.lisp inside a pair of LETs that hides the global
swank::*buffer-package* and cl:*package*, in:

(defun eval-for-emacs (form buffer-package id)
  "Bind *BUFFER-PACKAGE* BUFFER-PACKAGE and evaluate FORM.
Return the result to the continuation ID.
Errors are trapped and invoke our debugger."
  (call-with-debugger-hook
   #'swank-debugger-hook
   (lambda ()
     (let (ok result)
       (unwind-protect
            (let ((*buffer-package* (guess-buffer-package buffer-package))
                  (*buffer-readtable* (guess-buffer-readtable buffer-package))
                  (*pending-continuations* (cons id *pending-continuations*)))
              (check-type *buffer-package* package)
              (check-type *buffer-readtable* readtable)
              ;; APPLY would be cleaner than EVAL. 
              ;;(setq result (apply (car form) (cdr form)))
              (setq result (eval form))
              (finish-output)
              (run-hook *pre-reply-hook*)
              (setq ok t))
         (force-user-output)
         (send-to-emacs `(:return ,(current-thread)
                                  ,(if ok `(:ok ,result) '(:abort)) 
                                  ,id)))))))

and in the with-buffer-syntax macro which binds *package*:

(defslimefun listener-eval (string)
  (clear-user-input)
  (with-buffer-syntax ()
    (let ((*slime-repl-suppress-output* :unset)
          (*slime-repl-advance-history* :unset))
      (multiple-value-bind (values last-form) (eval-region string t)
        (unless (or (and (eq values nil) (eq last-form nil))
                    (eq *slime-repl-advance-history* nil))
          (setq *** **  ** *  * (car values)
                /// //  // /  / values))
        (setq +++ ++  ++ +  + last-form)
        (cond ((eq *slime-repl-suppress-output* t) '(:suppress-output))
              (*record-repl-results*
               `(:present ,(loop for x in values 
                              collect (cons (prin1-to-string x) 
                                            (save-presented-object x)))))
              (t 
               `(:values ,(mapcar #'prin1-to-string values))))))))

So, to avoid the problem, these functions should check the *package*
and *buffer-package* variables after evaluating user code, and reset
them out of the local bindings.  Said otherwise, it's a bug in slime. ;-)


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

CONSUMER NOTICE: Because of the "uncertainty principle," it is
impossible for the consumer to simultaneously know both the precise
location and velocity of this product.
From: BobF
Subject: Re: (reset-cluser)
Date: 
Message-ID: <hgj1ynmrji56.n3dcjjczc4hb.dlg@40tude.net>
On Fri, 09 Jun 2006 22:28:18 +0200, Pascal Bourguignon wrote:

>> BobF <··@thanks.net> writes:
> 
>> For those that haven't grown tired of this yet ...
>>

>  Said otherwise, it's a bug in slime. ;-)

I've moved on, but thanks for bringing my confidence in my sanity back. <g>