Make with-testing-buffer macro return evaluated result of the body

master
Hugo Thunnissen 6 years ago
parent 4422553506
commit 1fc1d3902e

@ -11,11 +11,10 @@
(defmacro with-testing-buffer (file-name &rest body) (defmacro with-testing-buffer (file-name &rest body)
"Execute 'body using a buffer with the contents of file 'file-name, "Execute 'body using a buffer with the contents of file 'file-name,
killing the buffer afterwards" killing the buffer afterwards"
(list 'let (list (list 'buffer (list 'with-current-buffer (list 'find-file (format "%s/test/testdata/%s" cwd file-name))
(list 'find-file (list 'let (list (list 'result (append '(progn) body)))
(list 'format "%s/test/testdata/%s" cwd file-name)))) '(kill-buffer (current-buffer))
(let ((to-execute (list 'with-current-buffer 'buffer))) 'result)))
(append to-execute body (list '(kill-buffer buffer))))))
(load (format "%sstomp.el" default-directory) nil t) (load (format "%sstomp.el" default-directory) nil t)

Loading…
Cancel
Save