Next: , Up: Project Descriptors


4.1.1.1 Themes

If you have several projects sharing the same option set, you might want to setup a theme. Themes are named collections of project options.

Themes are stored in the patcher-themes user option. This option is a list of themes. Each theme has the following form: ‘(NAME :OPTION VALUE ...)’.

NAME is the theme's name (a symbol). The remainder of the list is a sequence of zero or more option/value pairs, just like in project descriptors.

In order to use a theme in a given project, a :themes project option is provided. It is a list of theme names (symbols). Use this option in your project descriptor, and the project will implicitly inherit all options from the corresponding theme.

One important note: as :themes is a project option, it can appear in a theme. In other words, themes can inherit from other themes. When Patcher tries to retrieve an option from a theme (an that option is not directly available), the themes tree is traversed depth first.

Because themes can contain themes, a bogus setting might lead to an infinite loop (a cycle in a theme graph). To prevent this, the patcher-max-theme-depth user option is provided. It represents the expected maximum theme nesting level and defaults to 8.

Patcher comes with a set of built-in themes for several revision control systems. These are Git, Mercurial (Hg), Darcs, Subversion (Svn), CVS and PRCS. Look at the value of patcher-built-in-themes to see what's in them. Each of these themes have a -ws counterpart which eliminates white-space differences in diff outputs. This comes in handy if you are a committer (see Project Check In) and you perform some kind of automatic white-space cleanup in the files you edit, especially when you let Patcher generate the ChangeLog entries (see ChangeLogs Handling).

While you can't modify the value of patcher-built-in-themes, you're free to do whatever you want in patcher-themes, including creating a theme with the same name as a built-in one. This new theme will take precedence over the other. Having this built-in variable (a constant, actually) lets me modify its value from release to release without risking to smash your own adjustments.