Next: , Previous: Section Show, Up: Variables

5.1.4 Special Variables

Some variables have special meaning that changes attributes when templates are compiled, including:

This is the character sequence that escapes from raw text to template macro names. The ability to change the escape characters are key for enabling SRecode templates to work across many kinds of languages.
This is the character sequence that escapes the end of a template macro name.


          set escape_start "$"
          set escape_end "$"

This is the major mode, as a string with the full Emacs Lisp symbol in it. All templates in this file will be installed into the template table for this major mode.

Multiple template files can use the same mode, and all those templates will be available in buffers of that mode.


          set mode "emacs-lisp-mode"

The priority of a file is a number in a string constant that indicates where it lies in the template search order. System templates default to low priority numbers. User templates default to high priority numbers. You can specify the priority of your template to insert it anywhere in the template search list.

If there are multiple templates with the same context and name, the template with the highest priority number will be used.

If multiple files have the same priority, then then sort order is unpredictable. If no template names match, then it doesn't matter.


          set priority "35"

If a template file contains templates only needed for a particular application, then specify an application. Template files for an application are stored in the template repository, but are not used in the generic template insertion case.

The application with a particular name will access these templates from Lisp code.


          set application "document"

If a template file contains templates, or template overrides specific to a set of files under a particular directory, then that template file can specify a “project” that it belongs to.

Set the “project” special variable to a directory name. Only files under that directory will be able to access the templates in that file.

Any template file that has a project specified will get have a priority that is set between SRecode base templates, and user defined templates.

Templates can be compiled via a project system, such as EDE. EDE loaded templates will get a project set automatically.


          set project "/tmp/testproject"

If you need to insert the characters that belong to the variables escape_start or escape_end, then place those into a variable. For example

     set escape_start "$"
     set escape_end "$"
     set DOLLAR "$"