Function: f-with-sandbox

f-with-sandbox is a macro defined in f.el.

Signature

(f-with-sandbox PATH-OR-PATHS &rest BODY)

Documentation

Only allow PATH-OR-PATHS and descendants to be modified in BODY.

Source Code

;; Defined in ~/.emacs.d/elpa/f-20241003.1131/f.el
(defmacro f-with-sandbox (path-or-paths &rest body)
  "Only allow PATH-OR-PATHS and descendants to be modified in BODY."
  (declare (indent 1))
  `(let ((paths (if (listp ,path-or-paths)
                    ,path-or-paths
                  (list ,path-or-paths))))
     (unwind-protect
         (let ((f--guard-paths paths))
           ,@body)
       (setq f--guard-paths nil))))