Next: , Previous: Mode Line, Up: Emacs Interface

3.12.5 Configuration

The behavior of the Emacs interface can be controlled by a set of user-configurable settings. Some of these can be changed on the fly, while some require Emacs to be restarted. To set a variable on the fly, type M-x set-variable <RET> VariableName <RET> Value <RET>. Note that variable names can be completed by typing a few characters and then pressing <TAB>.

To set a variable so that the setting is used every time Emacs is started, add lines of the following format to ~/.emacs:

     (setq VariableName Value)

Note that the Emacs interface is presently not using the ‘Customize’ functionality to edit the settings.

The available settings are:

The Prolog system to use. Defaults to 'sicstus, which will be assumed for the rest of this chapter. See the on-line documentation for the meaning of other settings. For other settings of prolog-system the variables below named sicstus-something will not be used, in some cases corresponding functionality is available through variables named prolog-something.
The version of SICStus that is used. Defaults to '(4 . 2). Note that the spaces are significant!
Set to t (the default) to enable the source-linked debugging extensions by default. The debugging can be enabled via the Prolog menu even if this variable is nil. Note that the source-linked debugging only works if sicstus-version is set correctly.
How many positions to indent the body of a clause. Defaults to tab-width, normally 8.
The number of positions to indent code inside grouping parentheses. Defaults to 4, which gives the following indentation.
          p :-
                  (   q1
                  ;   q2,

Note that the spaces between the parentheses and the code are automatically inserted when <TAB> is pressed at those positions.

Set to nil to prevent single %-comments from being automatically aligned. Defaults to t.

Note that comments with one % are indented to comment-column, comments with two % to the code level, and that comments with three % are never changed when indenting.

Set to nil to prevent indentation of text inside /* ... */ comments. Defaults t.
This is a list with keywords that are highlighted in a special color when used as directives (i.e. as :- keyword). Defaults to
            '("block" "discontiguous" "dynamic" "initialization"
              "meta_predicate" "mode" "module" "multifile" "public" "volatile"
              "det" "nondet"                      ; for spdet

Set to nil to prevent Emacs from automatically indenting the next line when pressing <RET>. Defaults to t.
Set to t to enable deletion of all whitespace before the cursor when pressing <DEL> (unless inside a comment, string, or quoted atom). Defaults to nil.
Set to t to enable the electric dot function. If enabled, pressing . at the end of a non-empty line inserts a dot and a newline. When pressed at the beginning of a line, a new head of the last predicate is inserted. When pressed at the end of a line with only whitespace, a recursive call to the current predicate is inserted. The function respects the arity of the predicate and inserts parentheses and the correct number of commas for separation of the arguments. Defaults to nil.
Set to t to enable the electric underscore function. When enabled, pressing underscore (_) when the cursor is on a variable, replaces the variable with the anynomous variable. Defaults to nil.
Set to nil to use built-in functions of Emacs for parsing the source code when indenting. This is faster than the default but does not handle some of the syntax peculiarities of Prolog. Defaults to t.
What position the parsing is done from when indenting code. Two possible settings: 'beg-of-line and 'beg-of-clause. The first is faster but may result in erroneous indentation in /* ... */ comments. The default is 'beg-of-line.
Set to t to enable a new Predicate menu that contains all predicates of the current file. Choosing an entry in the menu moves the cursor to the start of that predicate. Defaults to nil.
The info node for the SICStus predicate index. This is important if the online help function is to be used (by pressing C-c ?, or choosing the Prolog/Help on predicate menu entry). The default setting is "(sicstus)Predicate Index".
Set to nil to not make underscore (_) a word-constituent character. Defaults to t.

Font-locking uses a number of “faces”, which can be customized with regular Emacs commands, for instance M-x describe-face <RET> FaceName <RET>. The following faces are relevant:

highlight   since release 4.2
Source code highlight at debug ports.
pltrace-face-reached-det   since release 4.2
Highlight for a line of code reached by coverage analysis with no nondet calls made from that line of code.
pltrace-face-reached-nondet   since release 4.2
Highlight for a line of code reached by coverage analysis with one or more nondet calls made from that line of code.
pltrace-face-reached-not   since release 4.2
Highlight for a line of code not reached by coverage analysis.
prolog-warning-face   since release 4.2
Face used in warning messages.
prolog-informational-face   since release 4.2
Face used in informational messages.
prolog-exception-face   since release 4.2
Face used in the first line of an error exception message, as well as to highlight Exception port displays.
prolog-error-face   since release 4.2
Face used in other lines of exception messages.
prolog-call-face   since release 4.2
Face used to highlight Call port displays.
prolog-exit-face   since release 4.2
Face used to highlight Exit port displays.
prolog-redo-face   since release 4.2
Face used to highlight Redo port displays.
prolog-fail-face   since release 4.2
Face used to highlight Fail port displays.
prolog-builtin-face   since release 4.2
Face used to highlight keywords used in directives (see sicstus-keywords).

Send feedback on this subject.