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!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With