Using Generic-Mode in Emacs

These tables are generated using a python script which extracts the data from Matlab files. To write every caption or heading only once I use a data file in which I store key:value-pairs.

Example file:

# comment
key-1: this is the snippet which reoccurs often.
key-2: and this is another one

To highlight the keys and the comments I use generic-mode (see in Emacswiki).

(define-generic-mode 'chunkdata-mode
  '("#")
  nil
  '(("^[a-zA-Z0-9\-\_\,]+:" . 'font-lock-variable-name-face))
  nil
  nil
  "Majormode for my chunks.data-files")

To enable this I added:

# -*- mode:chunkdata -*-

in the first line of the data-file. Now all Comments are highlighted in dark-red and all keys in dark-yellow. The result is a much better readability.