9.6 Following Error Messages

Many standard SWI-Prolog facilities generate messages that refer to specific source code locations. For example, loading a Prolog file that contains singleton variables into the top-level produces warning messages pointing to the starting line of the clauses where the singleton variables occur. If you enable compilation-shell-minor-mode in the top-level buffer, Emacs recognizes the Prolog messages that refer to source locations and provides convenient commands for visiting such source locations from the top-level buffer. See (emacs)Compilation Mode, For more information about compilation-shell-minor-mode.

To use compilation-shell-minor-mode automatically in all top-level buffers, you can arrange for the sweeprolog-top-level-mode hook to enable it as follows:

(add-hook 'sweeprolog-top-level-mode-hook