Function: pp-to-string

pp-to-string is an autoloaded and byte-compiled function defined in pp.el.gz.

Signature

(pp-to-string OBJECT)

Documentation

Return a string containing the pretty-printed representation of OBJECT.

OBJECT can be any Lisp object. Quoting characters are used as needed to make output that read can handle, whenever this is possible.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/pp.el.gz
;;;###autoload
(defun pp-to-string (object)
  "Return a string containing the pretty-printed representation of OBJECT.
OBJECT can be any Lisp object.  Quoting characters are used as needed
to make output that `read' can handle, whenever this is possible."
  (with-temp-buffer
    (lisp-mode-variables nil)
    (set-syntax-table emacs-lisp-mode-syntax-table)
    (let ((print-escape-newlines pp-escape-newlines)
          (print-quoted t))
      (prin1 object (current-buffer)))
    (pp-buffer)
    (buffer-string)))