Function: f--destructive

f--destructive is a macro defined in f.el.

Signature

(f--destructive PATH &rest BODY)

Documentation

If PATH is allowed to be modified, yield BODY.

If PATH is not allowed to be modified, throw error.

Source Code

;; Defined in ~/.emacs.d/elpa/f-20241003.1131/f.el
(defmacro f--destructive (path &rest body)
  "If PATH is allowed to be modified, yield BODY.

If PATH is not allowed to be modified, throw error."
  (declare (indent 1))
  `(if f--guard-paths
       (if (--any? (or (f-same-p it ,path)
                       (f-ancestor-of-p it ,path)) f--guard-paths)
           (progn ,@body)
         (signal 'f-guard-error (list ,path f--guard-paths)))
     ,@body))