From xemacs-m  Tue Apr 29 17:17:46 1997
Received: from martigny.ai.mit.edu (martigny.ai.mit.edu [18.43.0.152])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id RAA06928
	for <xemacs-beta@xemacs.org>; Tue, 29 Apr 1997 17:17:45 -0500 (CDT)
Received: from berne.ai.mit.edu by martigny.ai.mit.edu with SMTP
	(1.40.112.8/16.2) id AA264542261; Tue, 29 Apr 1997 18:17:41 -0400
From: Bill Dubuque <wgd@martigny.ai.mit.edu>
Message-Id: <199704292217.AA264542261@martigny.ai.mit.edu>
Received: by berne.ai.mit.edu
	(1.40.112.8/16.2) id AA216652258; Tue, 29 Apr 1997 18:17:38 -0400
Date: Tue, 29 Apr 1997 18:17:38 -0400
To: drich@cisco.com
Cc: xemacs-beta@xemacs.org
Subject: indentation catches syntax errors [was: sudccess with 20.2b3 on Solaris 2.5.1 (with problems)]

Dan Rich <drich@cisco.com> wrote: 
> >     o	I'm seeing assorted weird behavior from my .emacs file.  The
> >      	one that I can't figure out at all is the following:
> 
> > 	(if (not (eq (device-type) 'tty))
> > 	    (add-hook 'tipgp-:cmd-macro-before-hook 'my-ispell-message)
> > 	    (add-hook 'mail-send-hook  'my-ispell-message)
> > 	)

How did you manage to get the code indented incorrectly in the first 
place? If you composed the code in emacs-lisp-mode it would look like

(if (not (eq (device-type) 'tty))
    (add-hook 'tipgp-:cmd-macro-before-hook 'my-ispell-message)
  (add-hook 'mail-send-hook  'my-ispell-message))

and the correct indentation would immediately highlight the problem.

This is one of the main advantages of automatic indentation, i.e.
that it graphically highlights syntax errors. If you find yourself
overriding the default indentation then usually either you're doing 
something wrong syntactically, or you're using a new special form 
that the indenter needs to be taught about (or else you don't like 
the default indentation and want to override it for some reason).

Experienced lisp programmers read code by its shape (indentation)
just as you read words by their shape (to verify this, cover up
the bottom half of all letters in a sentence and notice that you 
can still read it quite easily even without seeing the bottom half
of all of the letters). This is one of the main advantages of
using a standard indentation style: everyone can read the program
structure much more quickly based on the shape of the code. If
you're a novice Lisp programmer, you should take advantage of the
built-in indentation tools to help you correctly shape your code.

-Bill Dubuque

