srecode: Parts of SRecode

 
 3 Parts of SRecode
 ******************
 
 The SRecode system is made up of several layers which work together to
 generate code.
 
 3.1 Template Layer
 ==================
 
 The template layer provides a way to write, and compile templates.  The
 template layer is the scheme used to insert text into an Emacs buffer.
 
    The SRecode template layer is more advanced than other modes like the
 Emacs packages ‘skeleton’ or ‘tempo’ in that it allows multiple layers
 of templates to be created with the same names.  This means that SRecode
 can provide a wide range of templates, and users can override only the
 small sections they want, instead of either accepting someone else’s
 template, or writing large new templates of their own.
 
    Templates are written in ‘.srt’ files.  You can learn how to author
 new ‘.srt’ files SeeTemplate Writing.
 
    While the template system was designed for SRecode based applications
 it can also be used independently for simple template insertion during
 typical coding.
 
 3.2 Template Manager
 ====================
 
 Once templates have been written, a scheme for loading and selecting
 templates is needed.  The template manager has a loader for finding
 template files, and determining which templates are relevant to the
 current buffer.  Template files are sorted by priority, with user
 templates being found first, and system level default templates last.
 Templates are also sorted by application.  Each application has its own
 templates, and are kept separate from the generic templates.
 
 3.3 Dictionary
 ==============
 
 Dictionaries contain values associated with variable.  Variables are
 used in macros in a template.  Variables are what allows a generic
 template such as a function to be made specific, such as a function
 named foo.  The value of a variable can be one of three things; a
 string, a list of more dictionaries, or a special
 ‘srecode-dictionary-compound-value’ object subclass.  See See
 Variables for more.
 
 3.4 Template Insertion
 ======================
 
 The template insertion layer involves extensions to the basic template
 layer.  A wide range of custom variables are available for mixing
 derived data as macros into the plain text of a template.
 
    In addition, templates can be declared with arguments.  These
 arguments represent predetermined sets of dictionary values, such as
 features of the current file name, user name, time, etc.
 
    Some arguments are major-mode specific, such as the ‘:el’ or ‘:cpp’
 arguments.
 
 3.5 Template Insertion Context
 ==============================
 
 A context can be provided for templates in a file.  This helps
 auto-selection of templates by name, or allows templates in different
 contexts to have the same name.  Some standard contexts are ‘file’,
 ‘declaration’, and ‘classdecl’.
 
    A context can be automatically derived as well based on the parsing
 state from Semantic.  SeeSemantic Manual (semantic)Top.
 
 3.6 Applications
 ================
 
 Commands that do a particular user task which involves also writing
 Emacs Lisp code.  Applications are at the top layer.  These applications
 have their own template files and logic needed to fill in dictionaries
 or position a cursor.  SRecode comes with an example ‘srecode-document’
 application for creating comments for Semantic tags.  The CEDET
 application EDE has a project type that is an SRecode application.
 
 3.7 Field Editing
 =================
 
 If the variable ‘srecode-insert-ask-variable-method’ is set to ’field,
 then variables that would normally ask a question, will instead create
 “fields” in the buffer.  A field-editing layer provides simple
 interaction through the fields.  Typing in a field will cause all
 variable locations that are the same to edit at the same time.  Pressing
 TAB on a field will move you to the next field.