home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / EMACSMOD / LIFE-MOD.DOC < prev    next >
Text File  |  1996-06-04  |  5KB  |  131 lines

  1.                 
  2.                       Life Mode for Emacs
  3.  
  4.  
  5.  
  6. There are two different parts in the life mode:
  7.   - One is a major emacs mode for editing life code (It deals essentially with
  8.     indentation). It should work with Prolog programs too !
  9.     It is contained in the 'life-mode.el' file.    
  10.   - The other allows people using emacs19 to see their code highlighted, thanks
  11.     to a Life tokenizer written in emacs lisp.
  12.     It is contained in the 'life-emphasize.el' file.
  13.  
  14. A third file ('.emacs-life') is necessary and should be loaded by your .emacs,
  15. or added to it. Change the path of the files loaded (using absolute paths), 
  16. and edit it to customize the mode.
  17.  
  18.  
  19.  
  20. Commands of the major mode:
  21.  
  22.  
  23.    TAB    : indent current line (see customization below)
  24.    M-C-\  : indent a region
  25.    C-x %  : comment a region
  26.    C-x $  : uncomment a region
  27.  
  28.    (M = meta key, C = control key)
  29.  
  30. Customization of the major mode: (see the '.emacs_life' file)
  31.  
  32.    There are three kinds of comments:
  33.     - large comments start with %%%. They are always indented at column 0.
  34.     - mid-comments start with %%. They are indented as life code, unless there
  35.       is a comment on the line before. In the latter case, the comments are 
  36.       aligned.
  37.     - small comments start with %.
  38.       If small-comments is non-nil, they are idented to comment-column 
  39.       (default value is 48), unless there is a comment on the line before.
  40.       Otherwise, they are idented like mid-comments.
  41.       Default of small-comments is nil.
  42.  
  43.    TAB may be used as a real tab in some places. If the variable
  44.    life-tab-always-indent is not nil, TAB in Life mode should always reindent
  45.    the current line, regardless of where in the line point is when the TAB
  46.    command is used. Otherwise, TAB inserts a tab when it is not in the
  47.    indenting region (before the first non void character on a line).   
  48.    The default value of this variable is t.
  49.  
  50.  
  51.    life-brace-offset is the amount of extra indentation for a line if the line
  52.    before starts with an open brace. Its default value is 4. Bodies of clauses
  53.    are indented at twice the value of life-brace-offset.
  54.  
  55.    life-multiline-offset is the amount of extra indentation for more than one
  56.    line long sentences (sequence of terms ending with , ; or |). Its default
  57.    value is 2. 
  58.  
  59.  
  60. Limitations 
  61.  
  62.    The indenter first looks for the beginning of the clause the pointer is in.
  63.    To recognise it, it looks for a dot or a question mark followed by a newline
  64.    (comments are skipped), and appearing inside a comment. There may be
  65.    problems if the dot or question mark appear inside a string or a quoted
  66.    atom.
  67.  
  68.    The 'life-multiline-offset' doesn't always work at the beginning of clauses.
  69.  
  70.  
  71. Commands of the highlighting mode:
  72.  
  73.    C-c C-b : highlight region or buffer
  74.    C-S-l   : (Control-Shift-l) re-highlight according to hilit-auto-rehighlight
  75.  
  76. Customization of the highlighting mode:
  77.  
  78.    If you use emacs19, and don't want highlighting, set the variable 
  79.    life-emphasize-flag to nil.
  80.  
  81.    A "face" is the structure used by emacs to describe the way terms are
  82.    written. Faces are created by the life-emphasize mode, that correspond to
  83.    various life tokens:
  84.       life-comment
  85.       life-atom
  86.       life-operator
  87.       life-value
  88.       life-syntax
  89.       life-variable
  90.  
  91.    You can use the following functions to customize the faces used.
  92.     
  93.     set-face-background
  94.       Change the background color of face FACE to COLOR (a string).
  95.     set-face-font
  96.       Change the font of face FACE to FONT (a string).
  97.     set-face-foreground
  98.       Change the foreground color of face FACE to COLOR (a string).
  99.     set-face-underline-p
  100.       Specify whether face FACE is underlined.  (Yes if UNDERLINE-P 
  101.     is non-nil.)
  102.  
  103.    example: (see the '.emacs-life' file)    
  104.  
  105.     (if life-emphasize-flag     
  106.       (progn
  107.         (set-face-font 'life-comment 
  108.         "-adobe-courier-bold-o-normal--14-100-100-100-m-90-iso8859-1")
  109.         (set-face-background 'life-value "darkslategrey")
  110.         (set-face-foreground 'life-syntax "red")
  111.         (set-face-underline-p 'life-variable t)
  112.     ))
  113.  
  114.  
  115.     Some user options used by hilit19 are supported by life-emphasize:
  116.  
  117.     - hilit-auto-highlight: T if we should highlight all buffers as we find
  118.                             'em, nil to disable 
  119.     - hilit-auto-highlight-maxout: auto-highlight is disabled in buffers larger
  120.                                    than this 
  121.     - hilit-auto-rehilight: If this is non-nil, then redraw and recenter will also 
  122.         rehighlight part or all of the current buffer.  T will rehighlight the
  123.       whole buffer, a NUMBER will rehighlight that many lines before and after
  124.         the cursor, and the symbol 'visible' will rehighlight only the visible
  125.         portion of the current buffer.  This variable is buffer-local.
  126.     - hilit-auto-rehighlight-fallback
  127.     - hilit-inhibit-rebinding: don't redefine locally C-l and C-y (thus
  128.                                preventing rehighlighting of yanked regions)    
  129.     - hilit-quietly: no message when rehighlighting    
  130.  
  131.