with-temp-buffer

with-temp-buffer is a Lisp macro in `subr.el'.

(with-temp-buffer &rest BODY)

Create a temporary buffer, and evaluate BODY there like `progn'.
See also `with-temp-file' and `with-output-to-string'.