This egg contains a simple filter program to indent Scheme source code.
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:
- do not convert tabs to spaces
- 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)
- restart indentation on non-whitespace at first column
- 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.
This egg is hosted on the CHICKEN Subversion repository:
If you want to check out the source code repository of this egg and you are not familiar with Subversion, see this page.
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.
- various bugfixes, removed "-d" option, thanks to "gahr" for reporting broken data detection
- initial release