[EMAIL PROTECTED] (sqweek) writes:

> On Thu, Aug 21, 2008 at 5:06 PM, Paul Donnelly
> <[EMAIL PROTECTED]> wrote:
>> The bear is indentation, since to make it work out it's
>> necessary to use a fixed-width font (something I'd rather not do) and
>> adjust it by hand, which needs to happen more often and by greater
>> degrees than in a language like C. The chief issues being:
>>
>> (list (list 'a 'b 'c)
>>       (list 1 2 3))
>> ;     ^
>> ;     These need to line up.
>>
>> ;     These need to line up.
>> ;     V
>> (let ((a 3)
>>       (b 4))
>>   (+ a b))
>> ; ^
>> ; Should be two spaces or so.
>
>  Huh. I always thought lisp had a couple of simple indentation rules,
> but after spending a little time on fmtsexp.c it has become apparent
> that the "two spaces or so" is a special case for let! Not sure I care
> to try and deal with such cases, but maybe it is still somewhat
> useful: http://sqweek.dnsdojo.org/plan9/fmtsexp.c
> -sqweek

A fairly complete description of the rules is that forms line up with
other forms at the same level of nesting (the binding forms in the LET
or the arguments to LIST), but anything using &BODY FOO in its lambda
list (&BODY collects trailing arguments into FOO) gets two-space
indentation for the body. Indeed, this is the reason &BODY
exists. DEFMETHOD, though, needs to be specially recognized.  LOOP has
special needs. It's easier to indent with a program running in or
communing with your Lisp, since there's no other way to know, short of
reading every file in a project, whether a given macro uses &BODY or
not.

Reply via email to