3.11.1.3 Enabling Emacs Support for SICStus

This section is for reference only; 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 `.pl' extension:

     (setq load-path
        (cons (expand-file-name "/usr/local/lib/sicstus-3.12.10/emacs")
              load-path))
     (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 (cons '("\\.pl$" . prolog-mode) auto-mode-alist))

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 3.12.10/emacs.

The last line above makes sure that files ending with `.pl' are assumed to be Prolog files and not Perl, which is the default Emacs setting. 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, then 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/bin/sicstus