The minor mode
whitespace around point automatically as you type:
Toggle automatic whitespace adjustment according to SWI-Prolog conventions.
It works by examining the context of point whenever a character is inserted in the current buffer, and applying the following layout rules:
Insert two consecutive spaces after the
starting a ‘PlDoc’ predicate documentation structured comment.
Insert spaces after a part of an if-then-else
constructs such that point is positioned four columns after its
beginning. The specific tokens that trigger this rule are the
( and the operators
*->, and only if
they are inserted in a callable context, where an if-then-else
construct would normally appear.
To enable this mode in a Sweep Prolog mode buffer, type M-x
sweeprolog-electric-layout-mode RET. You can automate this
step by adding
sweeprolog-mode-hook in your Emacs configuration:
(add-hook 'sweeprolog-mode-hook #'sweeprolog-electric-layout-mode)