7.4 Maintaining Code Layout

Some Prolog constructs, such as if-then-else constructs, have a conventional layout in which each goal starts at the fourth column after the beginning of the opening parenthesis or operator. For example:

(   if
->  then
;   else
*-> elif
;   true

To help you in maintaining the desired layout without having to manually count spaces, Sweep provides the command sweeprolog-align-spaces that updates the whitespace around point such that the next token is aligned to a (multiple of) four columns from the start of the previous token. Sweep also provides a dedicated minor mode sweeprolog-electric-layout-mode that adjusts whitespace around point automatically as you type (Electric Layout mode).