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
((λ 2)
 (and-let 1)
 (and-let* 1)
 (begin0-let 1)
 (begin0-let* 1)
 (begin-for-syntax 1)
 (begin-syntax 1)
 (call-with-input-pipe 0)
 (call-with-input-request 0)
 (call-with-input-string 0)
 (call-with-output-pipe 0)
 (call-with-output-string 0)
 (condition-case 1)
 (declare 1)
 (define-constant 1)
 (define-for-syntax 1)
 (define-inline 1)
 (define-macro 1)
 (define-record 1)
 (define-record-printer 1)
 (define-syntax-rule 1)
 (define-type 1)
 (fluid-let 1)
 (fluid-let* 1)
 (foreign-lambda 1)
 (foreign-lambda* 1)
 (foreign-safe-lambda 1)
 (foreign-safe-lambda* 1)
 (handle-exceptions 3 3 1)
 (if-let 1)
 (if-let* 1)
 (let-optionals 1)
 (let-optionals* 1)
 (or-let 1)
 (or-let* 1)
 (match 1)
 (match-lambda 1)
 (match-lambda* 1)
 (match-let 1)
 (match-let* 1)
 (module 3 3 1)
 (receive 3 3 1)
 (test-group 1)
 (unless-let 1)
 (unless-let* 1)
 (when-let 1)
 (when-let* 1)
 (with-current-directory 0)
 (with-input-from-encoded-file 0)
 (with-input-from-pipe 0)
 (with-input-from-port 0)
 (with-input-from-request 0)
 (with-input-from-string 0)
 (with-output-to-pipe 0)
 (with-output-to-port 0)
 (with-output-to-string 0))

Reply via email to