yitzchak / cl-indentify

Automatic indentation for Common Lisp
MIT License
21 stars 1 forks source link

Feature requests #2

Open atgreen opened 1 year ago

atgreen commented 1 year ago

Thank you for this great library! I'm using it in a transpiler project where I'm creating CL code and don't want to worry about formatting during codegen.

A couple of feature requests:

yitzchak commented 1 year ago

Added a commit to export load-templates.

Inserting additional newlines is probably beyond the capabilities of this library. It doesn't actually parse the code, so it would probably have a hard time deciding how to structure a lisp form.

For that you would need to parse the code and pretty print it. The stock pretty printer won't be able to print comments since those are not retained by the reader. To do that you'd need an extension to the pretty printer that could skip/print items that were read into an AST. I have done this as a "proof of concept" using Eclector and my in-progress pretty printer Inravina (which I am writing for SICL and maybe Clasp). It can be loaded extrinsically so eventually you could do something like this outside of the Lisp implementation's pretty printer.