Emacs and Prolog
Asked Answered
A

1

6

I downloaded SWI Prolog today but, I am having trouble getting emacs to recognize my prolog files. I am saving my prolog files with the extension .pl however, It keeps thinking they are perl files. In my home directory I have my ./.emacs file and I have my prolog.el file. Also at the end of my ./.emacs file I appended the following:

(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)

I am using this sample .emacs file: Sample Emacs File

Why will emacs not recognize my prolog file? I am not that experienced with emacs, so all help is greatly appreciated!

Actinomorphic answered 26/4, 2013 at 20:29 Comment(1)
You don't need your own prolog.el, since Emacs comes with one (and with the corresponding autoloads). OTOH your change to auto-mode-alist looks correct and should fix your problem, so I'm not sure why it doesn't.Pounds
G
8

Emacs comes pre-configured to work with Perl rather than Prolog for .pl, because Perl is much more commonplace. Add this to your .emacs to change the configuration permanently:

(add-to-list 'auto-mode-alist '("\\.\\(pl\\|pro\\|lgt\\)" . prolog-mode))

If you just want to do it once for a single file and editing session, M-x prolog-mode will do it.

Googins answered 26/4, 2013 at 20:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.