with-snippet-dirs: correct use of unwind-protect

This commit is contained in:
João Távora 2012-04-22 16:29:57 +01:00
parent 0bdb370c06
commit 4ae3bc0aff

View File

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