Emacs Lisp does not seem to have a PPRINT function. How do you pretty print an S-EXP in elisp the way you can in Common Lisp?
Use the pp
library which is part of GNU Emacs. For example you can use pp-macroexpand-last-sexp
for prettifying an sexp.
Assuming that the result of cl-prettyprint
is good enough for you, here's how to get its output in a stream.
(defun pprint (form &optional output-stream) (princ (with-temp-buffer (cl-prettyprint form) (buffer-string)) output-stream))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With