Node:Installation, Next:, Previous:Emacs Interface, Up:Emacs Interface



Installation

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.

Quick-Start

Assuming the Emacs interface for SICStus Prolog has been installed in the default location, inserting a single line in your ~/.emacs will make Emacs use the SICStus Prolog mode automatically when editing files with a .pl extension. It will also ensure Emacs can find the SICStus executables and on-line documentation, etc.

Note to Windows users: ~/.emacs denotes a file .emacs in whatever Emacs considers to be your home directory. See GNU Emacs FAQ For Windows 98/ME/NT/XP and 2000 at http://www.gnu.org/software/emacs/windows/ntemacs.html, for details.

On UNIX, assuming SICStus 3.10.1 was installed in /usr/local/, add the following line:

     (load-file "/usr/local/lib/sicstus-3.10.1/emacs/sicstus_emacs_init")
     

On Windows, assuming SICStus 3.10.1 was installer in C:\Program Files\SICStus Prolog 3.10.1\, add the following line:

     (load-file "C:/Program Files/SICStus Prolog 3.10.1/emacs/sicstus_emacs_init")
     

No other configuration should be needed to get started. If you want to customize things, look in the sictus_emacs_init.el file and the rest of this section.

Customizing Emacs

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.

Enabling Emacs Support for SICStus

This sub-section is for reference only; it will let you understand the set-up 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.10.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.10.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
     
Enabling Emacs Support for SICStus Documentation

If you follow the steps in Section Quick Start, above, you can skip this section.

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.10.1/doc/info/ on UNIX platforms and C:/Program Files/SICStus Prolog 3.10.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.10.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.