[plt-scheme] syntax coloring, #lang, Scribble

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Jul 28 21:58:58 EDT 2009

BTW, this works very nicely.  I keep finding little things that are
fun to try out like having just

  @foo

and then changing the language by adding and removing at-exp, and
seeing how the `@' gets colored differently.


On Jul 28, Matthew Flatt wrote:
> 
> Indentation is based on coloring, so it's already there to some
> degree, and I've improved Scribble coloring so that it indents
> better.
> 
> For example, if you re-indent the second line of
> 
>   @{A
>   B}
> 
> you now get
> 
>   @{A
>     B}

This seems to me as something that is close to how Emacs deals
"properly" with #; comments...  In other words, you get an advantage,
but there is also a big disadvantage: imagine reindenting a complete
file that has (reflective pun intended):

    @list{A better way to write this code:
            (define (foo x) (if (even? x) (foo (/ x 2)) (foo (add1 (* x 3)))))
          is:
            (define (foo x)
              (if (even? x)
                (foo (/ x 2))
                (foo (add1 (* x 3)))))
          }

If you do that, you basically destroy the meaning of the text...  (And
the same goes for any text, not just scheme examples.)

Is it possible to have this indentation apply only to explicit
indentation (after a newline, or when hitting tab), but not when
reindenting a block of text or the whole buffer?  Even for hitting
tab, I think that it makes more sense to do what Emacs is doing in
text modes (insert spaces until the cursor reaches the goal column,
even when the cursor has some whitespace after it).

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.