Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Pretty-printing lists (adding newlines and indent)

0 views
Skip to first unread message

Teemu Likonen

unread,
Dec 31, 2009, 10:43:55 AM12/31/09
to
Is there an easy way to pretty-print lists in Emacs Lisp? I mean adding
newlines and indents like in the inferior-emacs-lisp-mode (M-x ielm):

ELISP> '((a1 a2) (b1 (1 2 3 4 5)) (c1 c2))
((a1 a2)
(b1
(1 2 3 4 5))
(c1 c2))

I have a potentially big multi-level hierarchical list data which I'd
like to PRIN1 to a buffer. Having the whole list as a single line is
ugly and unreadable.

Teemu Likonen

unread,
Dec 31, 2009, 11:25:10 AM12/31/09
to
On 2009-12-31 17:43 (+0200), Teemu Likonen wrote:

> Is there an easy way to pretty-print lists in Emacs Lisp? I mean

> adding newlines and indents [...]

I found it myself: PP and PP-TO-STRING functions do exactly what I want.

0 new messages