Here's a minimalist[1] major mode to give the .mkmodel CSV files some
syntax highlighting in emacs-like operating systems, er, editors. Tested
only under XEmacs, but I don't think it does any mojo that would break
GNU Emacs.

Props to Andrew Cosgriff's itty-bitty procmail mode on this page:

        
http://tiny-tools.sourceforge.net/emacs-font.html#general_info_about_fontifying_with


[1] I plan to add more highlighting rules, better faces, etc., and would
like to borrow outline mode's expand / collapse features, but that ain't
happenin' tonight. Or ever, realistically. Right, Ian? :-)

(defun mkmodel-mode ()
  "Mode for highlighting MiddleKit .mkmodel files"
  (interactive)
  (setq mode-name "MK"
        major-mode 'mkmodel))


(copy-face 'font-lock-keyword-face       'mkmodel-font-lock-comment-face)
(copy-face 'font-lock-comment-face       'mkmodel-font-lock-member-face)
(copy-face 'font-lock-reference-face     'mkmodel-font-lock-class-face)
(copy-face 'font-lock-type-face          'mkmodel-font-lock-superclass-face)

;; font-lock-function-name-face
;; font-lock-doc-string-face



(setq mkmodel-font-lock-keywords
      (list '("#.*"
              . mkmodel-font-lock-comment-face)
            '("^\\(,\\)\\([^\ ,]*\\)\\([\ ]*(\\([^)]+\\))\\)?,"
              (2 mkmodel-font-lock-class-face t)
              (4 mkmodel-font-lock-superclass-face t t))
            '("^\\(,,\\)\\([^\ ,]*\\)"
              (2 mkmodel-font-lock-member-face t))))


(provide 'mkmodel)

Reply via email to