A portable implementation for srfi-159 Duy Nguyen (14 Feb 2020 12:39 UTC)
Re: A portable implementation for srfi-159 Lassi Kortela (14 Feb 2020 13:08 UTC)
Re: A portable implementation for srfi-159 Duy Nguyen (14 Feb 2020 13:13 UTC)
Re: A portable implementation for srfi-159 Lassi Kortela (14 Feb 2020 13:23 UTC)
Re: A portable implementation for srfi-159 Duy Nguyen (14 Feb 2020 13:26 UTC)
Standardizing some feature identifiers Lassi Kortela (14 Feb 2020 13:36 UTC)
Re: Standardizing some feature identifiers Lassi Kortela (14 Feb 2020 13:38 UTC)
Re: Standardizing some feature identifiers John Cowan (14 Feb 2020 13:40 UTC)
Re: Standardizing some feature identifiers Duy Nguyen (14 Feb 2020 13:43 UTC)
Re: Standardizing some feature identifiers Lassi Kortela (14 Feb 2020 13:51 UTC)
cond-expand portability Lassi Kortela (14 Feb 2020 13:45 UTC)
Re: cond-expand portability John Cowan (14 Feb 2020 14:29 UTC)
Re: cond-expand portability Lassi Kortela (14 Feb 2020 14:54 UTC)
Re: A portable implementation for srfi-159 Marc Nieper-Wißkirchen (14 Feb 2020 13:24 UTC)
Re: A portable implementation for srfi-159 Duy Nguyen (14 Feb 2020 13:28 UTC)
Re: A portable implementation for srfi-159 Marc Nieper-Wißkirchen (14 Feb 2020 13:33 UTC)
Pretty-printing and auto-formatting Scheme code Lassi Kortela (14 Feb 2020 13:34 UTC)
Re: Pretty-printing and auto-formatting Scheme code Duy Nguyen (14 Feb 2020 13:41 UTC)
Re: Pretty-printing and auto-formatting Scheme code Marc Feeley (14 Feb 2020 13:51 UTC)
Re: Pretty-printing and auto-formatting Scheme code Lassi Kortela (14 Feb 2020 14:02 UTC)
Re: Pretty-printing and auto-formatting Scheme code John Cowan (14 Feb 2020 14:07 UTC)
Re: Pretty-printing and auto-formatting Scheme code Lassi Kortela (14 Feb 2020 14:19 UTC)
Re: Pretty-printing and auto-formatting Scheme code Arthur A. Gleckler (14 Feb 2020 16:28 UTC)
Re: Pretty-printing and auto-formatting Scheme code Lassi Kortela (14 Feb 2020 17:05 UTC)
Re: Pretty-printing and auto-formatting Scheme code Arthur A. Gleckler (14 Feb 2020 20:02 UTC)
Re: Pretty-printing and auto-formatting Scheme code John Cowan (14 Feb 2020 21:59 UTC)
Re: Pretty-printing and auto-formatting Scheme code Lassi Kortela (14 Feb 2020 22:37 UTC)
Re: Pretty-printing and auto-formatting Scheme code John Cowan (15 Feb 2020 07:44 UTC)
Re: Pretty-printing and auto-formatting Scheme code Vladimir Nikishkin (15 Feb 2020 10:15 UTC)
More conventional syntax Lassi Kortela (15 Feb 2020 20:05 UTC)
Re: More conventional syntax John Cowan (15 Feb 2020 20:12 UTC)
Re: Pretty-printing and auto-formatting Scheme code Arthur A. Gleckler (15 Feb 2020 17:44 UTC)
Re: Pretty-printing and auto-formatting Scheme code John Cowan (15 Feb 2020 18:33 UTC)
Re: Pretty-printing and auto-formatting Scheme code Arthur A. Gleckler (15 Feb 2020 18:58 UTC)
Re: Pretty-printing and auto-formatting Scheme code Lassi Kortela (15 Feb 2020 19:47 UTC)
Re: A portable implementation for srfi-159 Arthur A. Gleckler (14 Feb 2020 16:20 UTC)
Re: A portable implementation for srfi-159 Duy Nguyen (15 Feb 2020 00:59 UTC)
Re: A portable implementation for srfi-159 Arthur A. Gleckler (15 Feb 2020 02:26 UTC)
Re: A portable implementation for srfi-159 Duy Nguyen (22 Feb 2020 12:50 UTC)
Re: A portable implementation for srfi-159 Arthur A. Gleckler (23 Feb 2020 07:52 UTC)

Re: Pretty-printing and auto-formatting Scheme code Lassi Kortela 14 Feb 2020 17:05 UTC

> I like the idea of a standard pretty-printer for Scheme code, but there
> is at least one difficulty specific to Lisps and Schemes: since we can
> extend the language with macros, we can add new forms to the language
> for which the indentation isn't automatically clear.  For example,
> here's an expression for defining an HTML template in a DSL I wrote:
>
>     (define-html-template (write-blog-navigation-links)
>          ((about (header-about-link))
>           (rss (header-rss-link "/blog/rss")))
>        ((div class "about") about)
>        rss)
>
> Note subexpression on the second and third lines.  It's a block of
> let-style bindings.  That block is indented to make it clear that it's
> different from the HTML expressions that follow.  Under Emacs, I use
> (put 'define-html-template 'scheme-indent-function 2) to automate that
> indentation.  A pretty-printer couldn't figure that setting out
> automatically.

I would solve that by putting

(declare-file
   (indent (define-html-template 2)))

at the top of every source file using `define-html-template`. But there
isn't yet evidence that everyone else doesn't hate `declare-file` :p

We could also have a per-project config file with the indentation
settings but then the file is not as self-contained. Last year I talked
about indentation to Racket folks and someone had the idea of adding a
formatting pass to their toolchain. That approach is a bit too
heavyweight for my taste because you need to indent using that
particular tool. It'd nice if e.g. Emacs could load a standalone Scheme
file, parse the `declare-file` and configure its indenter accordingly.