Function: pp--object

pp--object is a byte-compiled function defined in pp.el.gz.

Signature

(pp--object OBJECT REGION-FUNCTION)

Documentation

Pretty-print OBJECT at point.

The prettifying is done by REGION-FUNCTION which is called with two positions as arguments and should fold lines within that region. Returns the result as a string.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/pp.el.gz
;; There are basically two APIs for a pretty-printing function:
;;
;; - either the function takes an object (and prints it in addition to
;;   prettifying it).
;; - or the function takes a region containing an already printed object
;;   and prettifies its content.
;;
;; `pp--object' and `pp--region' are helper functions to convert one
;; API to the other.


(defun pp--object (object region-function)
  "Pretty-print OBJECT at point.
The prettifying is done by REGION-FUNCTION which is
called with two positions as arguments and should fold lines
within that region.  Returns the result as a string."
  (let ((print-escape-newlines pp-escape-newlines)
        (print-quoted t)
        (beg (point)))
    ;; FIXME: In many cases it would be preferable to use `cl-prin1' here.
    (prin1 object (current-buffer))
    (funcall region-function beg (point))))