Re: Pretty-printing and auto-formatting Scheme code Lassi Kortela 14 Feb 2020 22:37 UTC
> (declare-file > (indent (define-html-template 2))) > > at the top of every source file using `define-html-template`. > > Yes, that would be fine. My point was just that it would no longer > be a zero-configuration printer. > > I don't think putting stuff in files is general enough, because not all > pretty-printing is of code. Indeed, Emacs should be used for that (I do > even though I don't edit with Emacs). It's pretty-printing data, > especially at the REPL, that's the most important use of pp IME. Indeed, formatting code and pretty-printing an arbitrary S-expression are two different tasks. The declare-file stuff should only affect the formatting the source file it's in. Emacs scheme-mode should follow the same rules as all other Scheme code formatters. But it's useful to have formatters callable from outside Emacs: for example, batch formatters (`make format` or similar), linters for pre-commit hooks (is my code formatted right when I commit it?), continuous integration jobs, etc. And something to call from Vim :) Who knows, maybe it's even useful to format Scheme code from the REPL. In the same vein, there should be a "one true Common Lisp coding style" and auto-formatters for that, etc. I've dealt with auto-formatters for lots of languages, and us Lispers have it very easy.