There is an excellent Prolog mode for GNU Emacs and XEmacs. It is maintained by Stefan Bruda and available from https://bruda.ca/emacs/prolog_mode_for_emacs
The mode plays nicely with SWI-Prolog and other Prolog systems. It features syntax highlighting, automatic indentation, a predicate menu, and full interaction with a Prolog process.
The Prolog mode that is included in GNU Emacs ships with regressions that have been reported but not yet resolved. Therefore, we recommend to use Stefan Bruda's version of the mode as described in the following.
prolog.elfrom https://bruda.ca/emacs/prolog_mode_for_emacs and save it in your
load-pathso that Emacs can find it.
prolog.elfor better performance. Load
prolog.elinto Emacs and do
M-x byte-compile-file RET.
(autoload 'prolog-mode "prolog" "Major mode for editing Prolog programs." t) (add-to-list 'auto-mode-alist '("\\.pl\\'" . prolog-mode))
Where is ~/_emacs?
~ is a shortcut for the home directory, on Windows it is system
and language specific. It may be for example
C:\Dokumente. The best way to find "~" is: select
"Files->Open.." and enter "~". Then Emacs prints the directory
name and contents.
ediprolog allows you to interact with SWI-Prolog in all Emacs buffers. You can quickly consult buffers and regions, and run queries that are embedded in your source files. ediprolog is available from: https://github.com/triska/ediprolog