home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Editor / DVD!FX17.LHA / FrexxEd / fpl / FMC.FPL.README < prev    next >
Encoding:
Text File  |  1995-04-02  |  5.4 KB  |  136 lines

  1. #############################################################################
  2. File:                FMC.FPL
  3. Author:                Jesper Skov   (+ a bit by Daniel Stenberg)
  4. Email:                jskov@iesd.auc.dk
  5. Short:                File Mode Control - switches on modes based on file's ext
  6. Version:            2.0
  7. Date:                02.04.95
  8. Local settings:
  9. Global settings:
  10. Keysequence:
  11. Type:
  12. Prereq:
  13. Copyright:            © 1995, Jesper Skov
  14.                     Use/distribute according to the terms of GNU GPL.
  15.                     (See the file 'COPYING.GNU' for more info!)
  16. #############################################################################
  17.  
  18. FUNCTION
  19.   This package give FrexxEd the powerfull ability of recognizing different
  20.   file types, and act in a (by you) predefined manner. I think I better give
  21.   you some examples:
  22.  
  23.   You load a file named "test.fpl". Automatically C style indention is
  24.   switched on, and perhaps some ETags are loaded.
  25.  
  26.   I create a file named "text.tex". LaTeX mode gets switched on as does
  27.   double mode (I'm Danish - we have funky letters :)
  28.  
  29.   In both examples some other things may happend without you having to
  30.   explicitly specify it. This could be the syntax of comments being changed,
  31.   or needed external ARexx servers being launched.
  32.  
  33.  
  34.   For this to work FMC introduces a new concept - the major and minor modes.
  35.  
  36.   What are modes?
  37.  
  38.   Major mode:
  39.    A major mode is a FrexxEd "environment" which will allow communication
  40.    with external applications. This could be an assembler, compiler or a
  41.    viewer.
  42.    Only one major mode is active at a time.
  43.  
  44.   Minor mode:
  45.    A minor mode is a more text oriented interface - making it easier for the
  46.    user to work with the format of the text/source used by external
  47.    applications. This could be indention control for C, assembler or Pascal.
  48.    Maybe some macro packages for LaTeX or HyperText (AmigaGuide format).
  49.    Also things like word wrap and my DoubleMode are considered minor modes.
  50.    In short, anything not an interface is a minor mode.
  51.    Many minor modes may be active at a time.
  52.  
  53.  
  54.   "OK", you ask. "What's the big deal here?"
  55.  
  56.   Methaphorically speaking, you may now not only select what's for dinner,
  57.   but also what spices to use :)
  58.  
  59.   This is possible because each major mode has the following information:
  60.  
  61.   extensions: What file types should trigger this mode?
  62.               The extensions are case in-sensitive and separated with stars:
  63.               Examples: "*c*h*" - could be for a C mode.
  64.                         "*text*txt*readme*" - could be for a text mode.
  65.  
  66.   execute: A string that will be executed when the mode is switched on. This
  67.            string (full FPL syntax) includes the code responsible for
  68.            switching on minor modes. There may also be calls to (major) mode
  69.            specific initialization - these should be default settings from
  70.            the authors side.
  71.            To make it easier for you to add more spice, you may use a
  72.            function called ME(string mode_name). It will switch on the minor
  73.            mode of name "mode_name" (beats writing SetInfo(-1,mode_name,1);).
  74.            Example: "ME("double_mode");" - default in LaTeX mode.
  75.  
  76.   You may change these settings with "Customizing->Program->Major Modes", and
  77.   the idividual buffer's major mode and minor modes with
  78.   "Customizing->Buffer Mode->Major/Minor".
  79.  
  80.   Whenever you change a buffer's major mode, all minor modes are disabled. It
  81.   is then the job of the major mode's execute to enable the correct minor
  82.   modes.
  83.  
  84.  
  85.   Remember to put FMC.FPL early in your USER.FPL file. Preferably first.
  86.  
  87.  
  88.   You may also force a major mode by putting the string
  89.   "-*-<mode name>-*-" in the first line of a file. For example, if you write
  90.   many install scripts and have made a LISP major mode (it is LISP code,
  91.   right? Looks like it to me, anyway!) the first line of the file
  92.   "Install_english" could be "## -*-lisp_mode-*-" (## represents a comment -
  93.   I don't know the syntax, sorry). Now the buffer would be in LISP mode, even
  94.   though the file has no extension (as opposed to "file.lisp").
  95.  
  96.  
  97.   ------
  98.  
  99.   If you want to make your own major/minor modes all you have to do is to call
  100.   the function AddMode described below:
  101.  
  102.   AddMode(int type, string name, string extensions, string execute)
  103.  
  104.   type:       0 = minor mode, 1 = major mode
  105.   name:       name of mode info variable (e.g. "latex_mode")
  106.               (boolean, "LBH")
  107.   extensions: name of extensions info variable (e.g. "latex_ext")
  108.               Only for major mode! (string, "GSWH")
  109.   execute:    name of execute info variable (e.g. "latex_exe")
  110.               Only for major mode! (string, "GSWH")
  111.  
  112.   You must create the info variables yourself. They should have the type
  113.   strings listed above. If you are making a minor mode, extensions and
  114.   execute should be empty strings (e.g. AddMode(0,"double_mode","","")).
  115.  
  116.   If you have already made something that should be a major/minor mode, and
  117.   have any questions about how to make it FMC compatible, please let me know.
  118.   Also, you may find answer to your questions in some of my (or others) modes.
  119.   Check out DoubleMode (minor mode) and LaTeXCompile (major mode).
  120.  
  121.  
  122. HISTORY (REV)
  123.   02.04.95 (0)    Written with experience from LMC and FMC1.1, and after
  124.                 general acceptance of my ideas on the FrexxEd mailing
  125.                 list =)
  126.  
  127. BUGS
  128.   Be sure to report any bugs you may find!
  129.  
  130. TODO
  131.   Get old FPL modes prepped to the FMC.
  132.   Make people use the mode concept in the future.
  133.  
  134. SEE ALSO
  135.   Larry Niven & Steven Barnes' "The Barsoom Project" (ISBN: 0-330-31670-2)
  136.