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)
"Execute 'body using a buffer with the contents of file 'file-name,
killing the buffer afterwards"
(list 'let (list (list 'buffer
(list 'find-file
(list 'format "%s/test/testdata/%s" cwd file-name))))
(let ((to-execute (list 'with-current-buffer 'buffer)))
(append to-execute body (list '(kill-buffer buffer))))))
(list 'with-current-buffer (list 'find-file (format "%s/test/testdata/%s" cwd file-name))
(list 'let (list (list 'result (append '(progn) body)))
'(kill-buffer (current-buffer))
'result)))
(load (format "%sstomp.el" default-directory) nil t)

Loading…
Cancel
Save