See The Emacs Interface, for more information about installing the Emacs interface.
There are some differences between GNU Emacs and XEmacs. This will be indicated with Emacs-Lisp comments in the examples.
Version 20 of GNU Emacs and XEmacs introduced a new method for
editing and storing user settings. This feature is available from the
menu bar as Customize
and particular Emacs variables can be
customized with M-x customize-variable. Using Customize
is
the preferred way to modify the settings for emacs and
the appropriate customize commands will be indicated below, sometimes
together with the old method of directly setting Emacs variables.
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.9.1/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.9.1/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
It is possible to look up the documentation for any built in or library
predicate from within Emacs (using C-c ? or the menu). For this to
work Emacs must be told about the location of the info
-files that
make up the documentation.
The default location for the info
-files are
<prefix>/lib/sicstus-3.9.1/doc/info/
on UNIX platforms and
C:/Program Files/SICStus Prolog 3.9.1/doc/info/
on Windows.
Add the following to your ~/.emacs
file, assuming INFO is the
path to the info files, e.g. C:/Program Files/SICStus Prolog 3.9.1/doc/info/
(setq Info-default-directory-list (append Info-default-directory-list '("INFO")))for GNU Emacs, or
(setq Info-directory-list (append Info-directory-list '("INFO")))
for XEmacs. You can also use M-x customize-group <RET> info <RET> if your Emacs is new enough. You may have to quit and restart Emacs for these changes to take effect.