Function: pp-display-expression
pp-display-expression is a byte-compiled function defined in pp.el.gz.
Signature
(pp-display-expression EXPRESSION OUT-BUFFER-NAME)
Documentation
Prettify and display EXPRESSION in an appropriate way, depending on length.
If a temporary buffer is needed for representation, it will be named after OUT-BUFFER-NAME.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/pp.el.gz
(defun pp-display-expression (expression out-buffer-name)
"Prettify and display EXPRESSION in an appropriate way, depending on length.
If a temporary buffer is needed for representation, it will be named
after OUT-BUFFER-NAME."
(let* ((old-show-function temp-buffer-show-function)
;; Use this function to display the buffer.
;; This function either decides not to display it at all
;; or displays it in the usual way.
(temp-buffer-show-function
(lambda (buf)
(with-current-buffer buf
(goto-char (point-min))
(end-of-line 1)
(if (or (< (1+ (point)) (point-max))
(>= (- (point) (point-min)) (frame-width)))
(let ((temp-buffer-show-function old-show-function)
(old-selected (selected-window))
(window (display-buffer buf)))
(goto-char (point-min)) ; expected by some hooks ...
(make-frame-visible (window-frame window))
(unwind-protect
(progn
(select-window window)
(run-hooks 'temp-buffer-show-hook))
(when (window-live-p old-selected)
(select-window old-selected))
(message "See buffer %s." out-buffer-name)))
(message "%s" (buffer-substring (point-min) (point))))))))
(with-output-to-temp-buffer out-buffer-name
(pp expression)
(with-current-buffer standard-output
(emacs-lisp-mode)
(setq buffer-read-only nil)
(setq-local font-lock-verbose nil)))))