Skip to content
Jan Wielemaker edited this page Sep 25, 2025 · 6 revisions

Epilog: the SWI-Prolog console

Epilog
Epilog after splitting the console

Starting Epilog

Epilog provides the main application window if Prolog was started using the swipl-win executable. This is the default for the app, i.e., on Windows it is the default shortcut, it is the main executable of the MacOS bundle as well as the Linux flatpak. Alternatively, the SWI-Prolog REPL loop may be used on an OS terminal by starting swipl. If XPCE is present and there is a GUI context (always on MacOS and Windows, optional on most other Unix-derived OSes), an additional REPL loop can be started by running

?- epilog.

Using Epilog

An Epilog window is a terminal that runs a SWI-Prolog REPL loop in a dedicated thread. The terminal is implemented in XPCE. It uses the BSD libedit library to provide Emacs-style editing and history for the Prolog command line. Epilog provides an menu for several common tasks for managing the SWI-Prolog environment as well as a context menu (right click). Below are a few tips. Note that these also works in the OS terminal except that links to locations in Prolog files are in general not clickable.

  • TAB completes on files and atoms. This provides completion on modules, predicate names, (long) constants, etc. TAB extends to the next choice. Using TAB TAB or ESC-? shows all still available alternatives.
  • Ctrl-D is end-of-file, also on Windows. This terminates the console or ?- [user]. session.
  • Messages that are related to source locations are clickable links. Clicking these links calls edit/1 to open the built-in editor or user configured editor.
  • ls/0 lists files. .pl files are links that may be edited by clicking or compiled using the context menu.
  • explain/1 explains the argument. Using a predicate indicator (e.g., append/3) lists (clickable) locations where the predicate is defined and where it is called.

The Epilog terminal

The Epilog terminal handles most ANSI and other escape sequences that are commonly supported on modern terminals. It always operates using UTF-8 character encoding, supporting the full Unicode character set. On non-Windows systems, it uses a pty (Pseudo Terminal) to connect the Prolog thread I/O to the terminal. This implies that programs executed using shell/1 function normally. On Windows it uses pipes to realise the communication between the Prolog thread and the Epilog console. As a result, the I/O of processes started inside the Windows version of an Epilog console is not connected to the Epilog console.

Theme selection

The development tools define two themes: light and dark. If the SDL3 library reports that the system theme is dark, the dark theme is selected by default. Otherwise the light theme is the default. This can be overruled using the Settings/GUI Preferences menu which opens the editor on the XPCE defaults file. Ensure the file contains a line as below, where <theme> is one of light or dark or a user specified theme. A user specified theme is a file loadable as library(theme/<theme>).

display.theme: <theme>

The theme can also be controlled using the generic -D<flag>=<value> command line option of swipl and swipl-win, e.g.

swipl-win -Dtheme=dark
Clone this wiki locally