From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@9fans.net Date: Fri, 22 Aug 2008 08:38:32 +0000 From: Paul Donnelly Message-ID: <87tzddebf2.fsf@plap.localdomain> Content-Type: text/plain; charset=us-ascii References: <87pro3mnvl.fsf@plap.localdomain>, <140e7ec30808212157pb7ecfaeyfebe8d754fa0c9b5@mail.gmail.com> Subject: Re: [9fans] Acme without Flamage Topicbox-Message-UUID: 05045a6a-ead4-11e9-9d60-3106f5b1d025 sqweek@gmail.com (sqweek) writes: > On Thu, Aug 21, 2008 at 5:06 PM, Paul Donnelly > 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.