chickadee » scheme-indent

scheme-indent

Introduction

This egg contains a simple filter program to indent Scheme source code.

Usage

scheme-indent takes Scheme code from standard input and writes a properly indented version to standard output. A number of options allow to control the behaviour with respect to certain criteria, as follows:

-t
do not convert tabs to spaces
-p
separate closing parens by space
-T NUM
set tab-width to NUM (default is 8)
-I SYMBOL NUM
set indentation for list starting with SYMBOL
-N COLUMN
start with indentation at COLUMN (0-based)
-l
restart indentation on non-whitespace at first column
-n
ignore ".dir-locals.el" and ".editorconfig" files

Tabs are converted to 8 spaces by default. Whitespace is only modified at line-start, between ' (quote) / ` (quasiquote) and an opening parenthesis.

If a file with the name .editorconfig exists in the current directory, settings for tab_width and indent_style will be respected unless the -n option is given.

If a file with the name .dir-locals.el exists in the current directory, settings for tab-width and indent-tabs-mode are respected unless the -n option is given.

If .editorconfig exists .dir-locals.el is not loaded.

Command line-options can also be given by setting the environment variable SCHEME_INDENT. User options override options provided via environment variable. Settings from configuration files override any other settings given.

Note that scheme-indent is not a pretty-printer - newlines are never added or removed, only leading whitespace is modified. Nor is is it a linter, incorrect Scheme code is not detected and indentation will just proceed, regardless of syntactic errors like unmatched parantheses.

Authors

felix winkelmann

Repository

This egg is hosted on the CHICKEN Subversion repository:

https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/scheme-indent

If you want to check out the source code repository of this egg and you are not familiar with Subversion, see this page.

License

Copyright (c) 2023, Felix L. Winkelmann
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
  Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
  Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the
  distribution.
  Neither the name of the author nor the names of its contributors
  may be used to endorse or promote products derived from this
  software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

Version History

0.6
various bugfixes, removed "-d" option, thanks to "gahr" for reporting broken data detection
0.1
initial release