Keyword highlighting for .ini files etc based on a ‘source of truth’

Get any-ini-mode.el here: Lisp:any-ini-mode.el.

Quick overview:

An .ini file is this context is any file that has a structure of parameter settings, possibly broken into sections.


    editor = vi
    group = supers
    home = ~/home
    path = ~/home/backup
    always = TRUE

or maybe …

    NAME : user1
    GROUP : supers
    PATH : ~/home/backup

If you often edit particular types of these files and you would like to use intelligent keyword (section and param name) highlighting, then any-ini-mode is (IMHO) the answer.

To enable highlighting of the valid keywords in a particular type of file (say myapp.conf), you centrally store a ‘canonical’ file for the type (containing all the valid section and param names) and set up an any-ini ‘style’ that uses the canonical file.

Now name the style for the relevant filename (myapp.conf), and that’s it.

When any myapp.conf file is opened in future, the correct style will be automatically applied and the valid keywords highlighted.