]> code.delx.au - gnu-emacs-elpa/commitdiff
with-snippet-dirs: use UNWIND-PROTECT
authorJoão Távora <joaotavora@gmail.com>
Sat, 21 Apr 2012 10:58:12 +0000 (11:58 +0100)
committerJoão Távora <joaotavora@gmail.com>
Sat, 21 Apr 2012 10:58:12 +0000 (11:58 +0100)
yasnippet-tests.el

index a537b7feb1007213b964cff7e7825d853b626a6c..64742945bd96d48f9b5e05458485ba6f076be892 100755 (executable)
@@ -204,12 +204,13 @@ TODO: correct this bug!"
      ,@body))\r
 \r
 (defmacro with-snippet-dirs (dirs &rest body)\r
-  `(let ((default-directory (make-temp-file "yasnippet-fixture" t)))\r
-     (setq yas/snippet-dirs ',(mapcar #'car (cadr dirs)))\r
-     (mapc #'yas/make-file-or-dirs ,dirs)\r
-     ,@body\r
+  `(unwind-protect\r
+       (let ((default-directory (make-temp-file "yasnippet-fixture" t)))\r
+         (setq yas/snippet-dirs ',(mapcar #'car (cadr dirs)))\r
+         (mapc #'yas/make-file-or-dirs ,dirs)\r
+         ,@body)\r
      (when (>= emacs-major-version 23)\r
-         (delete-directory default-directory 'recursive))))\r
+       (delete-directory default-directory 'recursive))))\r
 \r
 ;;; Older emacsen\r
 ;;;\r