[mercury-users] Emacs mode
Dan Hazel
csdhazel at cc.uq.edu.au
Tue May 4 11:31:14 AEST 1999
On Tue, 04 May 1999, you wrote:
> Hello.
>
> I originally directed this question at a few of the developers, (thanks
> for the reply, DJ) but now I am going to pose it here, too.
>
> I have only just started teaching myself Mercury (heh), and I was
> wondering if anyone out there has made an Emacs mode for it? It is
> currently loading *.m files in ObjC mode.. And I am told that gvim gives
> you Matlab syntax highlighting. (my concern is not only the hightlighting,
> though.. The indenting is rather screwy, too.)
>
This may or may not work for you and I'm confident the Melbourne
men have more complete solutions. I use Ray Nickson's prolog-genind.el
which I'll attach. I haven't found much annoying about it's indentation
but then my mercury looks like prolog (+ func declarations). I can't think
of any peculiar syntax that might trip it up. (Of course it is extremely
annoying about any C code you may have embedded).
;-----------------------------------------------------------
(autoload 'prolog-genind-mode "prolog-genind"
"Ray Nickson's genind Prolog mode." t)
(autoload 'compilation-mode "compile"
"compilation mode." t)
(setq auto-mode-alist (cons '("\\.ql\$" . prolog-genind-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.m\$" . prolog-genind-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.err\$" . compilation-mode) auto-mode-alist))
;-----------------------------------------------------------
;
;I also add texture (and sleepiness) using font-lock:
;
(defvar merc-font-lock-keywords
'(
("^%:- pred .*$" 0 font-lock-preprocessor-face)
("^%:- mode .*$" 0 font-lock-preprocessor-face)
("^%:- func .*$" 0 font-lock-preprocessor-face)
("^%.*::.*$" 0 font-lock-preprocessor-face)
("^%.*semidet\\.$" 0 font-lock-preprocessor-face)
("^%.*nondet\\.$" 0 font-lock-preprocessor-face)
("^%.*det\\.$" 0 font-lock-preprocessor-face)
("^.*semidet\\.$" 0 font-lock-type-face)
("^.*nondet\\.$" 0 font-lock-type-face)
("^.*det\\.$" 0 font-lock-type-face)
("%.*$" 0 font-lock-comment-face)
("/\\*[^*]*\\*/" 0 font-lock-comment-face)
("^:- [^.]*\\.$" 0 font-lock-type-face)
("^['a-z][a-zA-Z0-9_']+" 0 font-lock-function-name-face)
("^:- pred .*$" 0 font-lock-type-face)
("^:- mode .*$" 0 font-lock-type-face)
("^:- func .*$" 0 font-lock-type-face)
("^:- module" 0 font-lock-type-face)
("^:- interface" 0 font-lock-type-face)
("^:- import_module" 0 font-lock-type-face)
("^:- implementation" 0 font-lock-type-face)
("-->" 0 font-lock-keyword-face)
("--->" 0 font-lock-keyword-face)
("(" 0 font-lock-keyword-face)
(")" 0 font-lock-keyword-face)
("{" 0 font-lock-keyword-face)
("}" 0 font-lock-keyword-face)
(";" 0 font-lock-keyword-face)
("," 0 font-lock-keyword-face)
("\\[" 0 font-lock-keyword-face)
("\\]" 0 font-lock-keyword-face)
("->" 0 font-lock-keyword-face)
("\\." 0 font-lock-keyword-face)
("=" 0 font-lock-keyword-face)
(" :-" 0 font-lock-keyword-face)
("[^'_a-zA-Z01-9]\\([_A-Z][a-zA-Z1-90]*\\)" 1 font-lock-variable-name-face)
("[^'_a-zA-Z01-9]\\([_A-Z]+\\)" 1 font-lock-variable-name-face)
)
"Font lock keywords for prolog-genind-mode.")
;;
(defun merc-mode-hook ()
"Mode hook for Prolog Genind mode, with Mercury texture support."
(require 'font-lock)
(setq font-lock-keywords merc-font-lock-keywords)
(font-lock-mode)
)
;;
(add-hook 'prolog-genind-mode-hooks 'merc-mode-hook)
;--------------------------------------------------------------
Dan Hazel
credit for attached to Ray Nickson (and Mark Utting?)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: genind.el
URL: <http://lists.mercurylang.org/archives/users/attachments/19990504/86afc81f/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: prolog.gel
URL: <http://lists.mercurylang.org/archives/users/attachments/19990504/86afc81f/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: prolog-genind.el
URL: <http://lists.mercurylang.org/archives/users/attachments/19990504/86afc81f/attachment-0002.ksh>
More information about the users
mailing list