(defun pprint (lst ind)
(strcat ind
"(\n"
(apply 'strcat
(mapcar (function (lambda (e)
(if (and e (listp e) (vl-list-length e) (vl-some 'listp e))
(pprint e (strcat ind " "))
(strcat ind " " (vl-prin1-to-string e) "\n")
)
)
)
lst
)
)
ind
")\n"
)
)
(princ (pprint '(1 2 (3 5) (1 . 2) 1 2 (1 (2 (3 4) 2)) 1) ""))
i use something of this kind to write formatted xml files