🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #189665

Re: prolog mode?

#189665
From: James Christopher Beard
Date: Thu, 06 Dec 1990 03:48
63 lines
3382 bytes
In article <BAGCHI.90Dec5120551@snarf.eecs.umich.edu> bagchi@eecs.umich.edu (Ranjan Bagchi) writes:
>
>	Does such a beast exist?
> 

There are a couple of answers to your question, depending on whether
you are using Quintus Prolog (2.5 or later) or not.

First the generic answer (not for Quintus): Our version of emacs
(18.55) seems to have come with a prolog mode, whose code is found in
the emacs/lisp (library) directory.  It should load automatically when
a file with the suffix ".prolog" is loaded.  If you use a different
suffix for prolog files (and who doesn't), you will probably wish to
modify the variable "auto-mode-alist".  I think you would use a
command like

(setq auto-mode-alist (cons '("\\.pl$" . prolog-mode) auto-mode-alist))

in your .emacs file.  This will have the effect of loading the library
file 'prolog-mode' whenever a file whose name ends in ".pl" is loaded.

Quintus Prolog (2.5 or later) version:
Quintus has produced its own version of prolog mode which is cranked
up by loading the file "qprolog-mode", part of a library of emacs lisp
found in the directory ${QUINTUS}/editor/gnu, where QUINTUS is the
absolute path of the top of the quintus prolog subtree.  The
documentation for it is (for 2.5.1) found in
${QUINTUS}/editor/gnu/README and in the 2.5.1 update documentation.  I
find that what they tell you to do doesn't ensure the proper loading
of qprolog-mode under all circumstances, so I do the following.

In .emacs, I have

(setq load-path (cons '"/usr/local/src/quintus/editor/gnu" load-path))
(setq load-path (cons "/users/beard/emacs" load-path))
(autoload 'run-prolog "qprolog-mode" "Run an inferior prolog process" t) 

Note that my emacs lisp subdirectory is now the first element of the
emacs load-path.  This is important, because there is a file
'prolog.el' there, with the following contents:

(load-library "qprolog-mode")

This pre-empts the emacs default prolog-mode.el, so that
"qprolog-mode," NOT the emacs library "prolog-mode," will be
automatically loaded when you edit a prolog (.pl) file without having
first launched Prolog.  (If the generic prolog-mode gets loaded before
qprolog-mode, it breaks part of the quintus/emacs interface.)

In .login, there is (as Quintus recommends)

setenv QUINTUS_EDITOR gnu
setenv QUINTUS_PROLOG_PATH /usr/local/src/quintus/bin2.5.1/sun4-4.1/prolog

The only part of this setup that differs from what Quintus prescribes
is, I think, the one-line prolog.el file in the first directory of
emacs' load-path.  There are other ways to make sure the interface
doesn't get broken when you edit a .pl file before running the inferior
prolog, but this is by far the simplest.

Good luck.

Jamie Beard  (beard@informatics.wustl.edu)
Technical Details
Message-ID: <1990Dec6.034845.11348@cec1.wustl.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!sunic!uupsi!rpi!zaphod.mps.ohio-state.edu!wuarchive!cec2!news
References: <BAGCHI.90Dec5120551@snarf.eecs.umich.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,2b9fe11c62233e34
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1990-12-06 18:42:25 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!sunic!uupsi!rpi!zaphod.mps.ohio-state.edu!wuarchive!cec2!news
From: jcb@wucs1.wustl.edu (James Christopher Beard)
Newsgroups: gnu.emacs.help
Subject: Re: prolog mode?
Message-ID: <1990Dec6.034845.11348@cec1.wustl.edu>
Date: 6 Dec 90 03:48:45 GMT
References: <BAGCHI.90Dec5120551@snarf.eecs.umich.edu>
Organization: Washington University, St. Louis MO
Lines: 63
Posted: Thu Dec  6 04:48:45 1990