blob: cd2444e50cff5cba0af4e901f1d3c91de9fabf98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
;;;; forget.lisp
(in-package #:forget)
(defun forget (symbol &key
(function? t)
(value? t)
(class? t)
(plist? t)
(interns? t)
(package? nil))
"Uninterns and forgets everything about a symbol"
(assert (symbolp symbol) (symbol) "~s is not a symbol." symbol)
(when (and function? (fboundp symbol))
(warn "Unbinding function ~s" symbol)
(fmakunbound symbol))
(when (and value? (boundp symbol))
(warn "Unbinding value ~s" symbol)
(makunbound symbol))
(when (and class? (find-class symbol nil))
(warn "Unbinding class ~s" symbol)
(setf (find-class symbol) nil))
(when (and plist? (symbol-plist symbol))
(warn "Dropping symbol-plist on ~s" symbol)
(setf (symbol-plist symbol) nil))
(when interns?
(warn "Uninterning ~s from ~s"
symbol
(package-name (symbol-package symbol)))
(unintern symbol (symbol-package symbol)))
(when (and package? (find-package symbol))
(warn "Deleting package ~s" (package-name (find-package symbol)))
(delete-package (find-package symbol))))
|