diff options
-rw-r--r-- | ennum.el | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -43,6 +43,17 @@ form in BODY." (unwind-protect (progn (cd ,directory) ,@body) (cd ,current-directory-symbol))))) +(defmacro ennum-with-temporary-directory (temporary-directory &rest body) + "Create temporary directory, evaluate BODY with the absolute +path of that directory assigned to TEMPORARY-DIRECTORY and +finally delete the temporary directory. The value returned is the +value of the last form in BODY." + (declare (indent defun)) + `(let ((,temporary-directory (make-temp-file "ennum" t))) + (unwind-protect + (progn ,@body) + (delete-directory ,temporary-directory t)))) + ;; TODO: Should the store have an absolute path to deal with directory ;; changes? Yes, since we ask for an absolute working directory, we ;; should. @@ -639,17 +650,6 @@ recognized as a directory, it should end in a slash. See (ennum--file-join (ennum-setting :images-directory) (ennum-video-link-poster link))))))) -(defmacro ennum-with-temporary-directory (temporary-directory &rest body) - "Create temporary directory, evaluate BODY with the absolute -path of that directory assigned to TEMPORARY-DIRECTORY and -finally delete the temporary directory. The value returned is the -value of the last form in BODY." - (declare (indent defun)) - `(let ((,temporary-directory (make-temp-file "ennum" t))) - (unwind-protect - (progn ,@body) - (delete-directory ,temporary-directory t)))) - (defun ennum-assoc-delete (key alist) "Delete KEY from ALIST. |