Function: with-output-to-string
with-output-to-string is a macro defined in subr.el.gz.
Signature
(with-output-to-string &rest BODY)
Documentation
Execute BODY, return the text it sent to standard-output, as a string.
Probably introduced at or before Emacs version 20.1.
Source Code
;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defmacro with-output-to-string (&rest body)
"Execute BODY, return the text it sent to `standard-output', as a string."
(declare (indent 0) (debug t))
`(let ((standard-output (generate-new-buffer " *string-output*" t)))
(unwind-protect
(progn
(let ((standard-output standard-output))
,@body)
(with-current-buffer standard-output
(buffer-string)))
(kill-buffer standard-output))))