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
(setq yas/snippet-dirs ',(mapcar #'car (cadr dirs))) (progn
(mapc #'yas/make-file-or-dirs ,dirs) (setq yas/snippet-dirs ',(mapcar #'car (cadr dirs)))
,@body) (mapc #'yas/make-file-or-dirs ,dirs)
(when (>= emacs-major-version 23) ,@body)
(delete-directory default-directory 'recursive)))) (when (>= emacs-major-version 23)
(delete-directory default-directory 'recursive)))))
;;; Older emacsen ;;; Older emacsen
;;; ;;;