Function: helpful--pretty-print

helpful--pretty-print is a byte-compiled function defined in helpful.el.

Signature

(helpful--pretty-print VALUE)

Documentation

Pretty-print VALUE.

If VALUE is very big, the user may press C-g (keyboard-quit) to gracefully stop the printing. If VALUE is self-referential, the error will be caught and displayed.

Source Code

;; Defined in ~/.emacs.d/elpa/helpful-20250408.334/helpful.el
(defun helpful--pretty-print (value)
  "Pretty-print VALUE.

If VALUE is very big, the user may press \\[keyboard-quit] to
gracefully stop the printing. If VALUE is self-referential, the
error will be caught and displayed."
  ;; Inspired by `ielm-eval-input'.
  (condition-case err
      (s-trim-right (pp-to-string value))
    (error
     (propertize (format "(Display error: %s)" (cadr err))
                 'face 'font-lock-comment-face))
    (quit
     (propertize "(User quit during pretty-printing.)"
                 'face 'font-lock-comment-face))))