chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Source code formatter?


From: Evan Hanson
Subject: Re: Source code formatter?
Date: Tue, 12 Jan 2021 23:10:23 +1300

Hi Paul,

On 2021-01-11 16:53, Vasilij Schneidermann wrote:
> Evan Hanson wrote one: https://git.foldling.org/schematic/

I did. I actually forgot about that! But I did, a while ago, and I've
been using it ever since, which I guess means it works?

You can install the "schematic" egg and try piping Scheme through the
"schematic-format" command to see whether it will work for your use
case. Theoretically it ought to work with other Schemes as well,
although I only ever tested the R7RS compatibility with Chibi and
Gauche.

Note that, despite the name, this is just an indenter, not a formatter
i.e. it won't wrap lines or rewrite your code in any way. I tend to
agree with Vasilij that such things are better left to the programmer.
But, for the sole purpose of auto-indentation, I think it's pretty OK.
The man page is available in Markdown format here:

    https://git.foldling.org/schematic/tree/master/schematic-format.1.md

I have this command hooked up to the '=' keybinding in Vim, so that (for
example) the keystroke '=ap' auto-indents the current paragraph:

    autocmd FileType scheme setlocal equalprg=schematic-format\ -b\ ~/.lispwords

I've attached my lispwords file in case it's useful. It includes a
handful of CHICKEN's special forms that have funky indentation
conventions. Dunno if any of this is helpful, but if you do give it a
try and run into issues just shout and I'll try to help!

All the best,

Evan

Attachment: .lispwords
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]