Enabling Emacs Support for SICStus

This section is for reference only, it can safely be skipped; it will let you understand the setup that is performed by the sictus_emacs_init.el file.

Assuming the Emacs interface for SICStus Prolog has been installed in the default location, inserting the following lines in your ~/.emacs will make Emacs use this mode automatically when editing files with a ‘.pro’ or ‘.pl’ extension:

(setq load-path
   (cons (expand-file-name "/usr/local/sicstus4.3.2/lib/sicstus-4.3.2/emacs")
(autoload 'run-prolog "prolog" "Start a Prolog sub-process." t)
(autoload 'prolog-mode "prolog" "Major mode for editing Prolog programs." t)
(setq prolog-use-sicstus-sd t)
(setq auto-mode-alist (append '(("\\.pro$" . prolog-mode)
                                ("\\.pl$" . prolog-mode))

where the path in the first line is the file system path to prolog.el (the generic Prolog mode) and sicstus-support.el (SICStus specific code). For example, ~/emacs means that the file is in the user’s home directory, in directory emacs. Windows paths can be written like C:/Program Files/SICStus Prolog VC12 4.3.2/emacs.

The last line above makes sure that files ending with ‘.pro’ or ‘.pl’ are assumed to be Prolog files and not Perl, which is the default Emacs setting for ‘.pl’. If this is undesirable, remove that line. It is then necessary for the user to manually switch to Prolog mode by typing M-x prolog-mode after opening a Prolog file; for an alternative approach, see Mode Line.

If the shell command sicstus is not available in the default path, it is necessary to set the value of the environment variable EPROLOG to a shell command to invoke SICStus Prolog. This is an example for C Shell:

% setenv EPROLOG /usr/local/sicstus4.3.2/bin/sicstus

Send feedback on this subject.