Next: , Previous: , Up: Installation   [Contents][Index]


3.12.1.3 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 sicstus_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.9.0/lib/sicstus-4.9.0/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 (append '(("\\.pro$" . prolog-mode)
                                ("\\.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 VC16 4.9.0/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, then 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 the UNIX standard shell:

% EPROLOG='/usr/local/sicstus4.9.0/bin/sicstus'; export EPROLOG


Send feedback on this subject.