SWI-Prolog 5.11.18 Reference Manual: Section 2.5

## 2.5 GNU Emacs Interface

The default Prolog mode for GNU-Emacs can be activated by adding the following rules to your Emacs initialisation file:

    (setq auto-mode-alist
          (append
           '(("\\.pl" . prolog-mode))
           auto-mode-alist))
    (setq prolog-program-name "swipl")
    (setq prolog-consult-string "[user].\n")
    ;If you want this.  Indentation is either poor or I don't use
    ;it as intended.
    ;(setq prolog-indent-width 8)

Unfortunately the default Prolog mode of GNU-Emacs is not very good. There are several alternatives though:

- http://turing.ubishops.ca/home/bruda/emacs-prolog/
- http://stud4.tuwien.ac.at/~e0225855/ediprolog/ediprolog.html
- http://stud4.tuwien.ac.at/~e0225855/pceprolog/pceprolog.html
- http://stud4.tuwien.ac.at/~e0225855/etrace/etrace.html