Function: custom-prin1-to-string

custom-prin1-to-string is a byte-compiled function defined in cust-print.el.gz.

Signature

(custom-prin1-to-string OBJECT &optional NOESCAPE)

Documentation

Return a string containing the printed representation of OBJECT, any Lisp object. Quoting characters are used when needed to make output that read can handle, whenever this is possible, unless the optional second argument NOESCAPE is non-nil.

This is the custom-print replacement for the standard prin1-to-string.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/cust-print.el.gz
(defun custom-prin1-to-string (object &optional noescape)
  "Return a string containing the printed representation of OBJECT,
any Lisp object.  Quoting characters are used when needed to make output
that `read' can handle, whenever this is possible, unless the optional
second argument NOESCAPE is non-nil.

This is the custom-print replacement for the standard `prin1-to-string'."
  (let ((buf (get-buffer-create " *custom-print-temp*")))
    ;; We must erase the buffer before printing in case an error
    ;; occurred during the last prin1-to-string and we are in debugger.
    (with-current-buffer buf
      (erase-buffer))
    ;; We must be in the current-buffer when the print occurs.
    (if noescape
	(custom-princ object buf)
      (custom-prin1 object buf))
    (with-current-buffer buf
      (buffer-string)
      ;; We could erase the buffer again, but why bother?
      )))