Simple case first. We have a lalala form and it has three arguments:

( lalala mamama papapapa nanana )

Notice that mamama, papapapa, nanana are aligned along to the left.

Another lalala form:

( lalala mamama ( if foo aaa bbb ) nanana )

It has three arguments but this time the second argument is an if form. Notice that the three arguments are still aligned along to the left in some sense, that is, the following three are on the same column:

the first letter of mamama

the first letter of the if form

the first letter of nanana

That observation is usually how you can spot the starting positions of arguments of some very long multi-line form (longer than our example.).

Let’s see some variations. For example:

( lalala mamama1 mamama2 a b c d e ( if foo aaa bbb ) nanana1 nanana2 )

That lalala form has these arguments: mamama1, mamama2, a, b, c, d, e, and then an if form, and then nanana1 and nanana2. Still nicely aligned. Readable.

What about that if form? Is that aligned good?

A simple if form:

( if ( bed-net-exists-p ) ( use-bed-net ) ( bring-a-fan ) ( turn-on-the-fan ) )

(Mosquitoes are in your room and you want to sleep. The code says “If there is a bed net, use it, else, bring a fan and turn on the fan (with wind blowing toward you. It’s a trick to make sure that little vampire helicopters can’t land on you)”)

The reason why the else clause (two lines) is indented less than the then clause (that is, (use-bed-net) ), at least for Emacs Lisp code, is that it’s good to be able to visually distinguish the else clause and the then clause. The text editor usually remembers this by saying “The first two arguments of an if form shall be treated special (specially indented) and unlike the rest of the arguments”. The first two arguments of our if form are (bed-net-exists-p) and (use-bed-net) .

The let forms are like this too. The text editor will treat the first argument of a let form specially. This let form:

( let ( ( a 1 ) ( b 1 ) ) ( message "hello" ) ( message "%d" ( + a b ) ) )

can be alternatively written as:

( let ( ( a 1 ) ( b 1 ) ) ( message "hello" ) ( message "%d" ( + a b ) ) )

Notice how the first argument (in the alternatively written one) is indented deeper than the rest of the arguments (two arguments).

If this were written using more lines like this:

( let ( ( a 1 ) ( b 1 ) ) ( message "hello" ) ( message "%d" ( + a b ) ) )

you can still spot the starting positions of the three arguments. You see the distinguished argument (the first argument) with its starting position being deep, and then you see the two non-distinguished arguments with their starting positions vertically aligned nevertheless. This observation will help you spot the arguments in more complicated let forms.

If you are curious, in general with other forms, there are just two cases:

It has no distinguished arguments and all arguments are aligned to the same level (if they are all on different lines), or

The first N arguments are distinguished and they are aligned to a common level, say D1, and the rest of the arguments are aligned to a separate common level, say D2, and D1 is deeper than D2.

Some quick exercises (answers in footnotes). Without counting parens and only looking at indentation, figure out how many non-distinguished arguments the following let form has:

( let ( ( x ( - 2 1 ) ) ( y 100 ) ( z ( + 1 1 ) ) ) ( lalala ( or z x ) y ) ( moo x y ) ( foo x y z ) )

By the way, did you see that the three expressions within the first argument are aligned as well?

Without counting parens, figure out how many lines the non-distinguished arguments of the following if form occupies, and figure out how many lines the then clause occupies:

( if ( bed-net-exists-p ) ( progn ( install-bed-net ) ( get-inside ) ( go-to-sleep ) ) ( bring-a-fan ) ( turn-on-the-fan ) ( go-to-sleep ) )

Without counting parens, figure out how many non-distinguished arguments are in the following if form and how many lines they span, and also figure out how many “statements” are in the then clause.