Call unload-feature
to undefine all symbols that were defined as part of loading an Elisp source or byte-compiled file. Make sure that your file ends by calling provide
at the end. This assumes that you loaded the file with one of the load
functions or via require
, it won't undefined symbols defined by C-M-x
(eval-defun
) or similar mechanisms.
If you really want to unbind symbols based on their name rather than based on the package that defined them, you can use mapatoms
to iterate over all symbols.
(mapatoms (lambda (symbol)
(if (string-prefix-p "foo-" (symbol-name symbol))
(unintern symbol))))