-
Notifications
You must be signed in to change notification settings - Fork 0
/
nukneval-1.2.el
46 lines (37 loc) · 1.27 KB
/
nukneval-1.2.el
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
40
41
42
43
44
45
46
;;; nukneval.el --- Nuke and reevaluate an elisp buffer.
;; Copyright 2002-2017 by Dave Pearson <davep@davep.org>
;; Author: Dave Pearson <davep@davep.org>
;; Version: 1.2
;; Keywords: lisp
;; URL: https://github.com/davep/nukneval.el
;; Package-Requires: ((cl-lib "0.5"))
;; nukneval.el is free software distributed under the terms of the GNU
;; General Public Licence, version 2. For details see the file COPYING.
;; Things we need:
;;; Commentary:
;;
;; nukneval.el provides a command that attempts to cleanly reevaluate a
;; buffer of elisp code.
;;; Code:
(eval-when-compile
(require 'cl-lib))
;;;###autoload
(defun nuke-and-eval ()
"Attempt to cleanly reevaluate a buffer of elisp code."
(interactive)
(save-excursion
(setf (point) (point-min))
(cl-loop for form = (condition-case nil
(read (current-buffer))
(error nil))
while form
do (let ((type (car form))
(name (cadr form)))
(cond
((memq type '(defun defun* defsubst cl-defun defalias defmacro))
(fmakunbound name))
((memq type '(defvar defparameter defconst defcustom))
(makunbound name))))))
(eval-buffer))
(provide 'nukneval)
;;; nukneval.el ends here