Log in

Problems with Emacs Prolog Major Mode - Emacs [entries|archive|friends|userinfo]

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Problems with Emacs Prolog Major Mode [Dec. 3rd, 2008|01:14 pm]
It seems that this site is the location of the most popular Emacs mode for Prolog. I've tried both the Debian package and the source distribution and neither of them seem to do a good job at syntax highlighting. For example, syntax of the form foo(X). (a functor) is correctly highlighted if it is a) the only functor on a line and b) not preceded by a tab or space character. I have GLOBAL-FONT-LOCK-MODE set to T and some Lisp/SLIME-specific stuff in my .emacs file. Nothing else.

Emacs Prolog Mode Syntax Coloring Issues

Note how color(5,green,b). is not colored and how all indented functors starting with adjacent(X,Y). are not colored.

My question: Has anyone experienced this problem? If so, have you fixed it with an alternative Prolog mode? I know Lisp syntax. How easy is it to wade into an Emacs mode definition file and modify it so it works as desired? Will I have to face a high learning curve if I try to do so?

[User Picture]From: lightning_rose
2008-12-04 05:45 pm (UTC)

I have no idea, but there was a post on this subject a couple of weeks ago.


(Reply) (Thread)
From: jkndrkn
2008-12-04 05:59 pm (UTC)
Heh. You're right. Excellent. I'm waiting to hear back from the Prolog mode maintainer before I commit to making any changes.
(Reply) (Parent) (Thread)
[User Picture]From: xah_lee
2008-12-06 09:18 am (UTC)
it may be that the mode is just a quick hack.

if prolog has lots of specific function names, then you can just follow the syntax coloring example, where the exact words for each function name is used and they'll be syntax colored. Alternatively, you can come up with a regex for the syn coloring, but that gets a bit complex as it's not easy to match all and not miss any or any other error...
(Reply) (Parent) (Thread)