This is a detailed guide for installing prolog-mode. Oh well, I am not sure whether people really need this, but I am providing it just in case. A summary of these instructions is at the beginning of the source file. If you are familiar with Emacs then you are probably better off going directly there.
Note to Windows users: In the following, whenever I use the drive letter “C” I really mean the drive on which your running Windows is installed.
The init file is a file that is read and evaluated by Emacs upon startup. If you use GNU Emacs or XEmacs version 21.1 or lower, this file is called ~/.emacs
. If you use XEmacs 21.4 or later, the init file is called init.el
and is placed in the directory ~/.xemacs
. In the following, I shall refer to both of these as the “init file,” with the understanding that the actual name of the file depends on the Emacs version used.
It is in the same place as in Unix, i.e., ~/.emacs
(~/_emacs
in some implementations) or ~/.xemacs/init.el
(depending on your Emacs version, see above). Although the path separator in Windows is the backslash (\), Emacs understands the forward slash (/) as path separator too. In fact, Emacs works better if you specify paths using, Unix-style, the forward slash. So I recommend that you specify paths in Windows like this:
d:/program files/xemacs/site-lisp
Who is ~
you ask? It is actually system dependent, but most often it is C:\
. To make sure, open your Emacs, select File → Open, enter ~
, and press Enter. Emacs will show the actual name and the content of ~
.
(setq load-path (cons "/usr/share/emacs/prolog" load-path))
Of course, replace /usr/share/emacs/prolog with the name of the directory where you actually put the file.
/usr/share/emacs/site-lisp
is most likely to be in load-path, and it is also a good place to put the file in. For XEmacs, either /usr/lib/xemacs/site-lisp
or /usr/local/lib/xemacs/site-lisp
are likely to be included automatically in load-path: look for /usr/lib/xemacs
or /usr/local/lib/xemacs
, create if necessary the directory site-lisp
in whichever of these exists, and place the file there./usr/lib/xemacs/site-lisp
or /usr/local/lib/xemacs/site-lisp
in Windows is c:/program files/xemacs-version/xemacs/site-lisp
, but I am not quite sure.xemacs -f batch-byte-compile -batch ./prolog.el
(autoload 'run-prolog "prolog" "Start a Prolog sub-process." t) (autoload 'prolog-mode "prolog" "Major mode for editing Prolog programs." t) (autoload 'mercury-mode "prolog" "Major mode for editing Mercury programs." t) (setq prolog-system 'swi) (setq auto-mode-alist (append '(("\\.pl$" . prolog-mode) ("\\.m$" . mercury-mode)) auto-mode-alist))
Change swi
to the system you are normally using. Possible choices are currently swi
, gnu
, sicstus
, mercury
, and eclipse
. If you use something else, leave the variable prolog-system as is (i.e., erase the respective line altogether) for interaction with a “generic” inferior Prolog process.
The last expression 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 not wanted, remove this line. It is then necessary to either
% -*- Mode: Prolog -*-
and then the respective file will be opened in Prolog mode no matter its extension, or
pl.exe
, but plcon.exe
. An example of “Prolog Program Name” would thus be(((getenv "EPROLOG") (eval (getenv "EPROLOG"))) (eclipse "eclipse") (mercury nil) (sicstus "sicstus") (swi "c:/program files/swi prolog/bin/plcon.exe") (t "prolog"))
Once you are satisfied with the changes do not forget to choose “Save for future sessions” so that your changes are recorded to disk.
In earlier versions syntax highlighting was supported but disabled by default, so that you had to enable it by hand. Starting with version 0.1.41, both the Prolog source and the inferior Prolog buffers are fontified upon opening.