public

My (rather unsuccessful) attempt at a better model for sandbox.el The idea is to generate valid sandbox bindings and evaluate them in this context, although the following does not work. Any pointers?

  • Download Gist
sandbox-eval-with-local-bindings.el
Emacs Lisp
1 2 3 4 5 6 7 8 9 10 11 12 13
(defun sandbox-macro-definitions (prefix)
(let ((sandbox-defun-symbol (intern (concat prefix "defun")))
(sandbox-progn-symbol (intern (concat prefix "progn"))))
`((,sandbox-defun-symbol (fcn args &rest body) (sandbox-defun fcn args body))
(,sandbox-progn-symbol (&rest body) (progn body)))))
 
(defmacro sandbox-eval-with-local-bindings (sexp &optional prefix)
"Sandbox SEXP, bind its unbound fns with macrolet and eval it."
(let ((prefix (or prefix sandbox-prefix)))
`(let ((prefix ,prefix))
(macrolet (,@(sandbox-macro-definitions prefix))
,(sandbox sexp)
))))

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.