这不能直接解决您的问题,但是如果您需要在重新启动时丢失所有变量,那么在单独的包中工作可能对您有用。
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}>.
然后你删除你的环境并且你没有这个变量,每次你重新定义包