Zmacs (as probably all of you know) indents IF statements to look
like:
(IF (TEST-FORM)
(THEN-FORM)
(ELSE-FORM))
And this indentation style can be seen in all the older Lisp code I
see as well. But GNU Emacs, contrary to other code I see, likes to
indent IF statements to look like:
(IF (TEST-FORM)
(THEN-FORM)
(ELSE-FORM))
I was wondering where GNUEMA got this style from? And why?
In article <··········@utic.unicomp.net> ···@utic.unicomp.net (Daniel Finster) writes:
>But GNU Emacs, contrary to other code I see, likes to
>indent IF statements to look like:
>
> (IF (TEST-FORM)
> (THEN-FORM)
> (ELSE-FORM))
GNU Emacs Lisp allows the else-clause to be an implicit PROGN, e.g.
(if (test-form)
(then-form)
(else-form-1)
(else-form-2)
...
(else-form-N))
In this case, it's useful for all the else-forms to be set off from the
then-form.
--
Barry Margolin
BBN Internet Services Corp.
······@near.net
Barry Margolin (······@nic.near.net) wrote:
>GNU Emacs Lisp allows the else-clause to be an implicit PROGN, e.g.
>
>(if (test-form)
> (then-form)
> (else-form-1)
> (else-form-2)
> ...
> (else-form-N))
If you use an explicit PROGN, the else-forms coincidentally line up
under the then-form:
(if test-form
then-form
(progn
else-form-1
...
else-form-N))
--
Kevin Rodgers <·············@ihs.com> Project Engineer
Information Handling Services Electronic Systems Development
15 Inverness Way East, M/S A203 GO BUFFS!
Englewood CO 80112 USA 1+ (303) 397-2807[voice]/-2779[fax]
In article <··········@utic.unicomp.net>, ···@utic.unicomp.net (Daniel
Finster) wrote:
> Zmacs (as probably all of you know) indents IF statements to look
> like:
>
> (IF (TEST-FORM)
> (THEN-FORM)
> (ELSE-FORM))
>
> And this indentation style can be seen in all the older Lisp code I
> see as well. But GNU Emacs, contrary to other code I see, likes to
> indent IF statements to look like:
>
> (IF (TEST-FORM)
> (THEN-FORM)
> (ELSE-FORM))
>
> I was wondering where GNUEMA got this style from? And why?
Because the E-Lisp syntax is actually
(if (TEST-FORM)
(THEN-FORM)
(ELSE-FORM-1)
(ELSE-FORM-2)
...)
the "else" clause actually being an implicit PROGN of everything after the
"then" clause. Hence the non-uncommon E-Lisp idiom for WHEN as
(if (not x)
nil
do
lots
of
things)
ZetaLisp also had this "extended-else" syntax (how does Zmacs indent ZL:IF
?), and probably other older Lisp variants as well.
pch