Emacs and Prolog

I downloaded SWI Prolog today, but I'm having trouble getting emacs to recognize my prolog files. I save my prolog files with the extension .pl , however, he continues to think that these 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 ./.emacs I added 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: Example Emacs File

Why doesn't emacs recognize my prolog? I'm not so experienced with emacs, so all help is much appreciated!

+4
source share
1 answer

Emacs comes preconfigured to work with Perl, not Prolog for .pl, because Perl is much more common. Add this to your .emacs to constantly change the configuration:

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

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

+6
source

All Articles