Reputation: 9526
How can I make swank forget all previously evaluated definitions?
I want it to undefine all macros, functions, and variables that where defined via evaluations (such as ,b
evaluate buffer). And have it returned to the same state as when I reboot my PC and freshly start the swank server.
I tried:
the slimv Clear-REPL (,-
) command:
This only appears to clear the screen (buffer).
CL-USER> (swank:restart-server)
(from the REPL buffer):
The server restarts but it still remembers my old defun
and other defines.
CL-USER> (slime-restart-inferior-lisp)
and `(slimv-restart-inferior-lisp)
Both are undefined.
Upvotes: 3
Views: 794
Reputation: 1505
Slimv author here. I added a new command 'Quit REPL' to slimv. This closes the lisp process running the swank server by calling swank:quit-lisp
, then closes the REPL buffer. You can use this one followed by another 'Connect Server' command to restart the REPL. The default mapping for 'Quit REPL' is <Leader>Q
, so you can restart the REPL by the <Leader>Q<Leader>c
sequence.
Please see commits 44a50afc... on GitHub or a8abdbbc... on BitBucket.
Upvotes: 6
Reputation: 11522
This not solve directly your problem, but if you need to lost all your variables when restart, maybe working in a separate package should work for you.
CL-USER> (defpackage :my-separate-package (:use :cl :cl-user :swank))
#<PACKAGE "MY-SEPARATE-PACKAGE">
CL-USER> (in-package :my-separate-package)
#<PACKAGE "MY-SEPARATE-PACKAGE">
MY-SEPARATE-PACKAGE> (defvar a "a")
A
MY-SEPARATE-PACKAGE> a
"a"
MY-SEPARATE-PACKAGE> (in-package :cl-user)
#<PACKAGE "COMMON-LISP-USER">
CL-USER> (in-package :my-separate-package)
#<PACKAGE "MY-SEPARATE-PACKAGE">
MY-SEPARATE-PACKAGE> a
"a"
MY-SEPARATE-PACKAGE> (in-package :cl-user)
#<PACKAGE "COMMON-LISP-USER">
CL-USER> (delete-package :my-separate-package)
T
CL-USER> (defpackage :my-separate-package (:use :cl :cl-user :swank))
#<PACKAGE "MY-SEPARATE-PACKAGE">
CL-USER> a
; Evaluation aborted on #<UNBOUND-VARIABLE A {1004AD9AF3}>.
CL-USER> (in-package :my-separate-package)
#<PACKAGE "MY-SEPARATE-PACKAGE">
MY-SEPARATE-PACKAGE> a
; Evaluation aborted on #<UNBOUND-VARIABLE A {10055C6063}>.
Then you delete your environment and you do not have this variables, everytime you redifine the package
Upvotes: 1