You are viewing emacs

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

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

Problems with Emacs Prolog Major Mode [Dec. 3rd, 2008|01:14 pm]
Previous Entry Share Next Entry

emacs

[jkndrkn]
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.

Screenshot:
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?
linkReply

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

(Link)


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

http://community.livejournal.com/emacs/28119.html

[User Picture]From: jkndrkn
2008-12-04 05:59 pm (UTC)

(Link)

Heh. You're right. Excellent. I'm waiting to hear back from the Prolog mode maintainer before I commit to making any changes.
[User Picture]From: xah_lee
2008-12-06 09:18 am (UTC)

(Link)

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...