home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 8 / CDASC08.ISO / VRAC / E17INFO.ZIP / FORMS < prev    next >
Encoding:
GNU Info File  |  1993-06-18  |  28.8 KB  |  834 lines

  1. This is Info file ../info/forms, produced by Makeinfo-1.55 from the
  2. input file forms.texinfo.
  3.  
  4.    This file documents forms-mode, a forms based major mode for GNU
  5. Emacs.
  6.  
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.  
  11. 
  12. File: forms,  Node: Top,  Next: What is in a Forms,  Up: (DIR)
  13.  
  14.    Forms mode is an Emacs major mode for working with simple plain-text
  15. databases in a forms-oriented manner. In forms mode, the information in
  16. these files is presented in an Emacs window in a user-defined format,
  17. one record at a time. Forms can be inspected read-only (viewing) or
  18. modified and updated.
  19.  
  20.    Forms mode is not a simple major mode, but requires two files to do
  21. its job: a control file and a data file. The data file holds the actual
  22. data which will be presented. The control file describes how it will be
  23. presented.
  24.  
  25. * Menu:
  26.  
  27. * What is in a Forms::    Introduction.
  28. * Data File Format::    How to format the data file.
  29. * Control File Format::    How to control forms mode.
  30. * Forms Format Description::
  31.             How to define the forms layout.
  32. * Modifying Forms Contents::
  33.             How to modify.
  34. * Forms Mode Commands::    The commands available, and how to use them.
  35. * Key Bindings::    Which keys are bound to what commands.
  36. * Miscellaneous::    Forms mode messages and other remarks.
  37. * Error Messages::    List of error messages forms mode can produce.
  38. * Examples::        Some examples.
  39. * Credits::        Thanks everyone.
  40. * Concept Index::    Index of Concepts
  41. * Variable Index::    Index of Variables.
  42. * Function Index::    Index of Functions.
  43.  
  44. 
  45. File: forms,  Node: What is in a Forms,  Next: Data File Format,  Prev: Top,  Up: Top
  46.  
  47. What is in a forms
  48. ==================
  49.  
  50.    Let's illustrate forms mode with an example. Suppose you are looking
  51. at your `/etc/passwd' file, and your screen looks as follows:
  52.  
  53.      ====== /etc/passwd ======
  54.      
  55.      User : root   Uid: 0   Gid: 1
  56.      
  57.      Name : Super User
  58.      
  59.      Home : /
  60.      
  61.      Shell: /bin/sh
  62.  
  63.    As you can see, the familiar fields from the entry for the super user
  64. are all there, but instead of being colon-separated on one single line,
  65. they make up a forms.
  66.  
  67.    The contents of the forms consists of the contents of the fields of
  68. the record (e.g. "root", "0", "1", "Super User") interspersed with
  69. normal text (e.g "User : ", "Uid: ").
  70.  
  71.    You can define yourself how text and fields will be used to make up
  72. the forms.
  73.  
  74.    When you modifiy the contents of the forms, it will be analyzed and
  75. the new contents of the fields of this record will be extracted. It
  76. possible, the file will be updated with the new contents.
  77.  
  78. 
  79. File: forms,  Node: Data File Format,  Next: Control File Format,  Prev: What is in a Forms,  Up: Top
  80.  
  81. Data file format
  82. ================
  83.  
  84.    Files for use with forms mode are very simple - each record (line)
  85. forms the contents one form.  Each record is supposed to consist of a
  86. number of fields. These fields are separated by the value of the string
  87. `forms-field-sep', which is a `TAB' by default.
  88.  
  89.    Fields may contain text which shows up in the forms in multiple
  90. lines.  These lines are separated in the field using a PSEUDO-NEWLINE
  91. character which is defined by the value of the string
  92. `forms-multi-line'. Its default value is a Control-K character. If it
  93. is set to `nil' multiple line fields are prohibited.
  94.  
  95. 
  96. File: forms,  Node: Control File Format,  Next: Forms Format Description,  Prev: Data File Format,  Up: Top
  97.  
  98. Control file format
  99. ===================
  100.  
  101.    The control file serves two purposes.
  102.  
  103.    First, it defines the data file to use, and its properties.
  104.  
  105.    Second, the Emacs buffer it occupies will be used by the forms mode
  106. to display the forms.
  107.  
  108.    The contents of the control file are evaluated using the Emacs
  109. command `eval-current-buffer', hence must contain valid Emacs-lisp
  110. expressions.  These expressions must set the following lisp variables
  111. to a suitable value:
  112.  
  113. `forms-file'
  114.      This variable must be set to the name of the data file.
  115.      Example:
  116.           (setq forms-file "my/data-file")
  117.  
  118. `forms-format-list'
  119.      This variable describes the way the fields of the record are
  120.      formatted on the screen. See the next section for details.
  121.  
  122. `forms-number-of-fields'
  123.      This variable holds the number of fields in each record of the data
  124.      file.
  125.      Example:
  126.           (setq forms-number-of-fields 10)
  127.  
  128.    An error will be given if one of the above values has not been set.
  129.  
  130.    Other variables that may be set from the control file are optional.
  131. Most of them have suitable default values.
  132.  
  133. `forms-field-sep'
  134.      This variable may be used to designate the string which separates
  135.      the fields in the records of the data file. If not set, it
  136.      defaults to a string containing a single `TAB' character.
  137.      Example:
  138.           (setq forms-field-sep "\t")
  139.  
  140. `forms-read-only'
  141.      If set to a value other than `nil', the data file is treated
  142.      read-only. If the data file can not be written into, read-only
  143.      mode is enforced. The default value for `forms-read-only' is
  144.      derived from the access permissions of the data file.
  145.      Example:
  146.           (set forms-read-only t)
  147.  
  148. `forms-multi-line'
  149.      This variable may be set to allow multi-line text in fields. It
  150.      should be set to a string of one character, which denotes the
  151.      pseudo new-line character to be used to separate the text lines.
  152.      Its default value is Control-K (octal 013). If set to `nil',
  153.      multi-line text fields are prohibited.
  154.      It may not be a character contained in `forms-field-sep'.
  155.      Example:
  156.           (setq forms-multi-line "\C-k")
  157.  
  158. `forms-forms-scroll'
  159.      *Note Forms Mode Commands:: for the description.
  160.  
  161. `forms-forms-jump'
  162.      *Note Forms Mode Commands:: for the description.
  163.  
  164. `forms-new-record-filter'
  165.      The control file may define a function `forms-new-record-filter',
  166.      or set `forms-new-record-filter' to such a function. If so, this
  167.      function is called when a new record is created to supply default
  168.      values for fields.
  169.  
  170. `forms-modified-record-filter'
  171.      The control file may define a function
  172.      `forms-modified-record-filter', or set
  173.      `forms-modified-record-filter' to such a function.  If so, this
  174.      function is called when a record is modified, just before writing
  175.      the modified record back to the data file.
  176.  
  177. 
  178. File: forms,  Node: Forms Format Description,  Next: Modifying Forms Contents,  Prev: Control File Format,  Up: Top
  179.  
  180. The forms format description
  181. ============================
  182.  
  183.    The value of the variable `forms-format-list' is used to specify the
  184. format of the forms. It must be a list of formatting elements, each of
  185. which can be a string, number, lisp list or a lisp symbol that
  186. evaluates to one of these. The formatting elements are processed in the
  187. order they appear in the list.
  188.  
  189.    A `string' formatting element is inserted in the forms "as is".
  190.  
  191.    A `number' element selects a field of the record. The contents of
  192. this field are inserted. The first field of the record has number 1
  193. (one).
  194.  
  195.    A `lisp list' specifies a function call. This function is called
  196. every time a record is displayed, and its result, that must be a
  197. string, is inserted in the forms. The function should do nothing but
  198. returning a string. The fields of the record being displayed are
  199. available to this function as the list `forms-fields' and can be
  200. accessed using `(nth 'FIELD NUMBER` forms-fields)'.  Fields are
  201. numbered starting from 1 (one).
  202.  
  203.    A `lisp symbol' must evaluate to one of the above possibilities.
  204.  
  205.    If a record does not contain the number of fields as specified in
  206. `forms-number-of-fields', a warning message will be printed. Excess
  207. fields are ignored, missing fields are set to empty.
  208.  
  209.    The control file which shows your `/etc/passwd' file as demonstrated
  210. in the beginning of this document might look as follows:
  211.      ;; This demo visits /etc/passwd.
  212.      
  213.      (setq forms-file "/etc/passwd")
  214.      (setq forms-number-of-fields 7)
  215.      (setq forms-read-only t)                 ; to make sure
  216.      (setq forms-field-sep ":")
  217.      (setq forms-multi-line nil)              ; not allowed
  218.      
  219.      (setq forms-format-list
  220.            (list
  221.             "====== /etc/passwd ======\n\n"
  222.             "User : "    1
  223.             "   Uid: "   3
  224.             "   Gid: "   4
  225.             "\n\n"
  226.             "Name : "    5
  227.             "\n\n"
  228.             "Home : "    6
  229.             "\n\n"
  230.             "Shell: "    7
  231.             "\n"))
  232.  
  233.    When functions are to be used in `forms-format-list' they must be
  234. quoted to prevent them from being evaluated too early:
  235.  
  236.      (setq forms-format-list
  237.            (list
  238.             "====== " forms-file " ======\n\n"
  239.             "User : "    1
  240.             '(make-string 20 ?-)
  241.             ...
  242.            ))
  243.  
  244.    Alternatively, instead of quoting the functions, the whole list may
  245. be quoted:
  246.  
  247.      (setq forms-format-list
  248.           '(
  249.             "====== " forms-file " ======\n\n"
  250.             "User : "    1
  251.             (make-string 20 ?-)
  252.             ...
  253.            ))
  254.  
  255.    Upon startup, the contents of `forms-format-list' are validated. If
  256. errors are encountered, processing is aborted with an error message
  257. which includes a descriptive text. *Note Error Messages::, for a
  258. detailed list of error messages.
  259.  
  260. 
  261. File: forms,  Node: Modifying Forms Contents,  Next: Forms Mode Commands,  Prev: Forms Format Description,  Up: Top
  262.  
  263. Modifying The Forms Contents
  264. ============================
  265.  
  266.    If a forms is not read-only, it's contents can be modified.
  267.  
  268.    All normal editor commands may be used to change the forms. There is
  269. no distinction between the "fixed" text and the text from the fields of
  270. the records. However, upon completion, the forms is parsed to extract
  271. the new contents of the fields. The "fixed" portions of the forms are
  272. used to delimit the fields, these portions should therefore not be
  273. modified to avoid the risk that the field contents cannot be determined.
  274. Moreover, ambiguous field contents, which can not be discriminated from
  275. "fixed" text, must be avoided.
  276.  
  277.    If the contents of the forms cannot be recognized properly, this is
  278. signaled using a descriptive text. *Note Error Messages::, for more
  279. info.  The cursor will indicate the last part of the forms which was
  280. successfully parsed.
  281.  
  282.    If `forms-modified-record-filter' has been set, this function is
  283. called before the new data is written to the data file. The function is
  284. called with one argument: a vector that contains the contents of the
  285. fields of the record. Fields can referenced or modified using the lisp
  286. functions `aref' and `aset'. The first field has number 1 (one). The
  287. function must return the (possibly modified) vector to the calling
  288. environment.
  289.  
  290.      (defun my-modified-record-filter (record)
  291.        ;; modify second field
  292.        (aset record 2 (current-time-string))
  293.        record        ; return it
  294.      )
  295.      (setq forms-modified-record-filter 'my-modified-record-filter)
  296.  
  297. 
  298. File: forms,  Node: Forms Mode Commands,  Next: Key Bindings,  Prev: Modifying Forms Contents,  Up: Top
  299.  
  300. Forms mode commands
  301. ===================
  302.  
  303. `M-x forms-find-file FILE'
  304.    Visits FILE, runs `eval-current-buffer' on it, and puts the buffer
  305. into forms-mode. The first record of the data file will be loaded and
  306. shown.
  307.  
  308.    The modeline will display the major mode `"Forms"' followed by the
  309. minor mode `"View"' if the file is visited read-only.  The number of
  310. the current record (N) and the total number of records (T) in the file
  311. is shown in the modeline as `"n/t"'.
  312. For example:
  313.      --%%-Emacs: passwd-demo          (Forms View 1/54)----All-------
  314.  
  315. `M-x forms-find-file-other-window FILE'
  316.    This command is similar to `forms-find-file', but visits the file in
  317. another window.
  318.  
  319.    If the buffer is not read-only, you may change the buffer to modify
  320. the fields in the record. When the current record is left, e.g. by
  321. switching to another record, the contents of the buffer are parsed
  322. using the specifications in `forms-format-list', and a new record is
  323. constructed which replaces the current record in the data file. Fields
  324. of the record which are not shown in the forms are not modified; they
  325. retain their original contents.
  326.  
  327.    Most forms mode commands are bound to keys, and are accessible with
  328. the conventional `C-c' prefix. In read-only mode this prefix is not
  329. used.  *Note Key Bindings::, for the default key bindigs used by forms
  330. mode.
  331.  
  332.    The following commands are available within forms mode.
  333.  
  334. `forms-next-record'
  335.      shows the next record. With a prefix argument, show the n-th next
  336.      record.
  337.  
  338. `forms-prev-record'
  339.      shows the previous record. With a prefix argument, show the n-th
  340.      previous record.
  341.  
  342. `forms-jump-record'
  343.      jumps to a record by number. A prefix argument is used for the
  344.      record number to jump to. If no prefix argument is supplied, a
  345.      record number is asked for in the minibuffer.
  346.      If an invalid record number is supplied, an error message is
  347.      displayed reading the offending record number, and the allowable
  348.      range of numbers.
  349.  
  350. `forms-first-record'
  351.      jumps to the first record.
  352.  
  353. `forms-last-record'
  354.      jumps to the last record. Also re-counts the number of records in
  355.      the data file.
  356.  
  357. `forms-next-field'
  358.      jumps to the next field in the forms. With a numeric argument:
  359.      jumps that many fields, or to the first field if there are not
  360.      that many fields left.
  361.  
  362.      Jumping to fields is implemented using markers, which are placed
  363.      in front of the fields. If the contents of the forms are modified,
  364.      the markers are adjusted. However, if text around a marker has
  365.      been deleted from the screen and inserted again it is possible
  366.      that this marker no longer points at its field correctly.  *Note
  367.      Markers: (emacs)Markers, for more information on markers.
  368.  
  369. `forms-view-mode'
  370.      switches to read-only mode. Forms mode commands may no longer be
  371.      prefixed with `C-c'.
  372.  
  373. `forms-edit-mode'
  374.      switches to edit mode. Forms mode commands must be prefixed with
  375.      `C-c'.
  376.      Switching to edit mode is only possible if write access to the data
  377.      file is allowed.
  378.  
  379. `forms-insert-record'
  380.      create a new record, which is inserted before the current record.
  381.      An empty form is presented, which can be filled in using familiar
  382.      editor commands. With a prefix argument: the new record is created
  383.      after the current one.
  384.  
  385.      If a function `forms-new-record-filter' was defined in the control
  386.      file, this function is called to fill in default values for
  387.      fields. The function is passed a vector of empty strings, one for
  388.      each field. For convenience, an additional element is added so the
  389.      numbers of the elements are the same as the numbers used in the
  390.      forms description. The function must return the (updated) vector.
  391.  
  392.      Instead of defining the function, `forms-new-record-filter' may be
  393.      set to a function.
  394.  
  395.      Example:
  396.           (defun my-new-record-filter (fields)
  397.             (aset fields 5 (login-name))
  398.             (aset fields 1 (current-time-string))
  399.             ;; and return it
  400.             fields)
  401.           (setq forms-new-record-filter 'my-new-record-filter)
  402.  
  403. `forms-delete-record'
  404.      deletes the current record. You are prompted for confirmation
  405.      before the record is deleted unless a prefix argument has been
  406.      provided.
  407.  
  408. `forms-search REGEXP'
  409.      searches for REGEXP in all records following this one. If found,
  410.      this record is shown.
  411.      The next time it is invoked, the previous regexp is the default,
  412.      so you can do repeated searches by simply pressing RET in response
  413.      to the prompt.
  414.  
  415. `revert-buffer'
  416.      reverts a possibly modified forms to its original state. It only
  417.      affect the record currently in the forms.
  418.  
  419. `forms-exit'
  420.      terminates forms processing. The data file is saved if it has been
  421.      modified.
  422.  
  423. `forms-exit-no-save'
  424.      aborts forms processing. If the data file has been modified Emacs
  425.      will ask questions.
  426.  
  427. `describe-mode'
  428.      gives additional help.
  429.  
  430. `save-buffer'
  431.      saves the changes in the data file, if modified.
  432.  
  433.    If the variable `forms-forms-scrolls' is set to a value other than
  434. `nil' (which it is, by default), the Emacs functions `scroll-up' and
  435. `scroll-down' will perform a `forms-next-record' and
  436. `forms-prev-record' when in forms mode.  So you can use your favourite
  437. page commands to page through the data file.
  438.  
  439.    Likewise, if the variable `forms-forms-jump' is not `nil' (which it
  440. is, by default), Emacs functions `beginning-of-buffer' and
  441. `end-of-buffer' will perform `forms-first-record' and
  442. `forms-last-record' when in forms mode.
  443.  
  444.    After forms mode is entered, functions contained in
  445. `forms-mode-hooks' are executed to perform user defined customization.
  446.  
  447. 
  448. File: forms,  Node: Key Bindings,  Next: Miscellaneous,  Prev: Forms Mode Commands,  Up: Top
  449.  
  450. Key bindings
  451. ============
  452.  
  453.    This section describes the key bindings as they are defined when
  454. invoking forms mode.
  455. All commands must be prefixed with `C-c' when editing a forms. If a
  456. forms is read-only, `C-c' is not used.  The only exception to this rule
  457. is `forms-next-field', which is bound to `TAB' in all maps.
  458.  
  459. `C-c TAB'
  460.      `forms-next-field'
  461.  
  462. `C-c SPC'
  463.      `forms-next-record'
  464.  
  465. `C-c <'
  466.      `forms-first-record'
  467.  
  468. `C-c >'
  469.      `forms-first-record'
  470.  
  471. `C-c d'
  472.      `forms-delete-record'
  473.  
  474. `C-c e'
  475.      `forms-edit-mode'
  476.  
  477. `C-c i'
  478.      `forms-insert-record'
  479.  
  480. `C-c j'
  481.      `forms-jump-record'
  482.  
  483. `C-c n'
  484.      `forms-next-record'
  485.  
  486. `C-c p'
  487.      `forms-prev-record'
  488.  
  489. `C-c q'
  490.      `forms-exit'
  491.  
  492. `C-c s REGEXP'
  493.      `forms-search'
  494.  
  495. `C-c v'
  496.      `forms-view-mode'
  497.  
  498. `C-c x'
  499.      `forms-exit-no-save'
  500.  
  501. `C-c ?'
  502.      `describe-mode'
  503.  
  504. `C-c DEL'
  505.      `forms-prev-record'
  506.  
  507. 
  508. File: forms,  Node: Miscellaneous,  Next: Error Messages,  Prev: Key Bindings,  Up: Top
  509.  
  510. Miscellaneous
  511. =============
  512.  
  513.    A global variable `forms-version' holds the version information of
  514. the current implementation of forms mode.
  515.  
  516.    It is very convenient to use symbolic names for the fields in a
  517. record.  The function `forms-enumerate' provides an elegant means to
  518. define a series of variables to consecutive numbers.  The function
  519. returns the higest number used, so it can be used to set
  520. `forms-number-of-fields' also:
  521.      (setq forms-number-of-fields
  522.            (forms-enumerate
  523.             '(field1 field2 field3 ... )))
  524.  
  525.    `field1' will be set to 1, `field2' to 2 and so on.
  526.  
  527.    Care has been taken to localize the current information of the forms
  528. mode, so it is possible to visit multiple files in forms mode
  529. simultaneously, even if they have different properties.
  530.  
  531.    Since buffer-local functions are not available in this version of GNU
  532. Emacs, the definitions of the filter functions
  533. `forms-new-record-filter' and `forms-modified-record-filter' are copied
  534. into internal, buffer local variables when forms-mode is initialized.
  535.  
  536.    If a control file is visited using the standard `find-file'
  537. commands, forms mode can be enabled with the command `M-x forms-mode'.
  538. Forms mode will be automatically enabled if the file contains the
  539. string `"-*- forms -*-"' somewhere in the first line. However, this
  540. makes it hard to edit the control file itself so you'd better think
  541. twice before using this.
  542.  
  543.    The default format for the data file, using TAB to separate fields
  544. and `C-k' to separate multi-line fields, matches the file format of
  545. some popular Macintosh database programs, e.g. FileMaker. So
  546. `forms-mode' could decrease the need to use Apple computers.
  547.  
  548. 
  549. File: forms,  Node: Error Messages,  Next: Examples,  Prev: Miscellaneous,  Up: Top
  550.  
  551. Error Messages
  552. ==============
  553.  
  554.    This section describes all error messages which can be generated by
  555. forms mode.
  556.  
  557. `'forms-file' has not been set'
  558.      The variable `forms-file' was not set by the control file.
  559.  
  560. `'forms-number-of-fields' has not been set'
  561.      The variable `forms-number-of-fields' was not set by the control
  562.      file.
  563.  
  564. `'forms-number-of-fields' must be > 0'
  565.      The variable `forms-number-of-fields' did not contain a positive
  566.      number.
  567.  
  568. `'forms-field-sep' is not a string'
  569. `'forms-multi-line' must be nil or a one-character string'
  570.      The variable `forms-multi-line' was set to something other than
  571.      `nil or' a single-character string.
  572.  
  573. `'forms-multi-line' is equal to 'forms-field-sep''
  574.      The variable `forms-multi-line' may not be equal to
  575.      `forms-field-sep' for this would make it impossible to distinguish
  576.      fields and the lines in the fields.
  577.  
  578. `'forms-format-list' has not been set'
  579. `'forms-format-list' is not a list'
  580.      The variable `forms-format-list' was not set to a lisp `list' by
  581.      the control file.
  582.  
  583. `Forms error: field number XX out of range 1..NN'
  584.      A field number was supplied with a value of XX, which was not
  585.      greater than zero and smaller than or equal to the number of
  586.      fields in the forms, NN.
  587.  
  588. `Forms error: not a function FUN'
  589.      The first element of the lisp list specified in `forms-format-list'
  590.      did not have a function value.
  591.  
  592. `Invalid element in 'forms-format-list': XX'
  593.      A list element was supplied in `forms-format-list' which was not a
  594.      `string', `number' nor a `lisp list'.
  595.  
  596. `Parse error: not looking at "..."'
  597.      When re-parsing the contents of a forms, the text shown could not
  598.      be found.
  599.  
  600. `Parse error: cannot find "..."'
  601.      When re-parsing the contents of a forms, the text shown, which
  602.      separates two fields, could not be found.
  603.  
  604. `Parse error: cannot parse adjacent fields XX and YY'
  605.      Fields XX and YY were not separated by text, so could not be
  606.      parsed again.
  607.  
  608. `Record has XX fields instead of YY'
  609.      The number of fields in this record in the data file did not match
  610.      `forms-number-of-fields'. Missing fields will be set to empty.
  611.  
  612. `Multi-line fields in this record - update refused!'
  613.      The current record contains newline characters, hence can not be
  614.      written back to the data file, for it would corrupt it.
  615.      probably a field was set to a multi-line value, while the setting
  616.      of `forms-multi-line' prohibited this.
  617.  
  618. `Record number XX out of range 1..YY'
  619.      A jump was made to non-existing record XX. YY denotes the number
  620.      of records in the file.
  621.  
  622. `Stuck at record XX'
  623.      An internal error prevented a specific record from being retrieved.
  624.  
  625. 
  626. File: forms,  Node: Examples,  Next: Credits,  Prev: Error Messages,  Up: Top
  627.  
  628. Examples
  629. ========
  630.  
  631.    The following example exploits most of the features of forms-mode.
  632. This example is included in the distribution as file `forms-d2.el'.
  633.  
  634.      ;; demo2 -- demo forms-mode    -*- emacs-lisp -*-
  635.      
  636.      ;; SCCS Status     : demo2    1.1.2
  637.      ;; Author          : Johan Vromans
  638.      ;; Created On      : 1989
  639.      ;; Last Modified By: Johan Vromans
  640.      ;; Last Modified On: Mon Jul  1 13:56:31 1991
  641.      ;; Update Count    : 2
  642.      ;; Status          : OK
  643.      ;;
  644.      ;; This sample forms exploit most of the features of forms mode.
  645.      
  646.      ;; Set the name of the data file.
  647.      (setq forms-file "forms-d2.dat")
  648.      
  649.      ;; Use 'forms-enumerate' to set field names and number thereof.
  650.      (setq forms-number-of-fields
  651.            (forms-enumerate
  652.             '(arch-newsgroup            ; 1
  653.           arch-volume            ; 2
  654.           arch-issue            ; and ...
  655.           arch-article            ; ... so
  656.           arch-shortname            ; ... ... on
  657.           arch-parts
  658.           arch-from
  659.           arch-longname
  660.           arch-keywords
  661.           arch-date
  662.           arch-remarks)))
  663.      
  664.      ;; The following functions are used by this form for layout purposes.
  665.      ;;
  666.      (defun arch-tocol (target &optional fill)
  667.        "Produces a string to skip to column TARGET. Prepends newline if needed.
  668.      The optional FILL should be a character, used to fill to the column."
  669.        (if (null fill)
  670.            (setq fill ? ))
  671.        (if (< target (current-column))
  672.            (concat "\n" (make-string target fill))
  673.          (make-string (- target (current-column)) fill)))
  674.      ;;
  675.      (defun arch-rj (target field &optional fill)
  676.        "Produces a string to skip to column TARGET minus the width of field FIELD.
  677.      Prepends newline if needed. The optional FILL should be a character,
  678.      used to fill to the column."
  679.        (arch-tocol (- target (length (nth field forms-fields))) fill))
  680.      
  681.      ;; Record filters.
  682.      ;; This example uses the (defun ...) method of defining.
  683.      ;;
  684.      (defun forms-new-record-filter (the-record)
  685.        "Form a new record with some defaults."
  686.        (aset the-record arch-from (user-full-name))
  687.        (aset the-record arch-date (current-time-string))
  688.        the-record                ; return it
  689.      )
  690.      
  691.      ;; The format list.
  692.      (setq forms-format-list
  693.           (list
  694.             "====== Public Domain Software Archive ======\n\n"
  695.             arch-shortname
  696.             " - "            arch-longname
  697.             "\n\n"
  698.             "Article: "        arch-newsgroup
  699.             "/"            arch-article
  700.             " "
  701.             '(arch-tocol 40)
  702.             "Issue: "        arch-issue
  703.             " "
  704.             '(arch-rj 73 10)
  705.             "Date: "            arch-date
  706.             "\n\n"
  707.             "Submitted by: "        arch-from
  708.             "\n"
  709.             '(arch-tocol 79 ?-)
  710.             "\n"
  711.             "Keywords: "        arch-keywords
  712.             "\n\n"
  713.             "Parts: "        arch-parts
  714.             "\n\n====== Remarks ======\n\n"
  715.             arch-remarks
  716.           ))
  717.      
  718.      ;; That's all, folks!
  719.  
  720. 
  721. File: forms,  Node: Credits,  Next: Concept Index,  Prev: Examples,  Up: Top
  722.  
  723. Credits
  724. =======
  725.  
  726.    Forms mode is developed by Johan Vromans `<jv@mh.nl>' at Multihouse
  727. Research in the Netherlands.
  728.  
  729.    Harald Hanche-Olsen `<hanche@imf.unit.no>' supplied the idea for the
  730. new record filter, and provided better replacements for some internal
  731. functions.
  732.  
  733.    Bugfixes and other useful suggestions were supplied by
  734. cwitty@portia.stanford.edu, Jonathan I. Kamens, Ignatios Souvatzis and
  735. Harald Hanche-Olsen.
  736.  
  737.    This documentation was slightly inspired by the documentation of
  738. "rolo mode" by Paul Davis at Schlumberger Cambridge Research
  739. `<davis%scrsu1%sdr.slb.com@relay.cs.net>'.
  740.  
  741.    None of this would have been possible without GNU Emacs of the Free
  742. Software Foundation. Thanks, Richard!
  743.  
  744. 
  745. File: forms,  Node: Concept Index,  Next: Variable Index,  Prev: Credits,  Up: Top
  746.  
  747. Concept Index
  748. *************
  749.  
  750. * Menu:
  751.  
  752. * forms-mode:                           Top.
  753. * pseudo-newline:                       Data File Format.
  754.  
  755. 
  756. File: forms,  Node: Variable Index,  Next: Function Index,  Prev: Concept Index,  Up: Top
  757.  
  758. Variable Index
  759. **************
  760.  
  761. * Menu:
  762.  
  763. * forms-field-sep:                      Control File Format.
  764. * forms-fields:                         Forms Format Description.
  765. * forms-file:                           Control File Format.
  766. * forms-format-list:                    Forms Format Description.
  767. * forms-format-list:                    Control File Format.
  768. * forms-forms-jump:                     Control File Format.
  769. * forms-forms-jump:                     Forms Mode Commands.
  770. * forms-forms-scroll:                   Forms Mode Commands.
  771. * forms-forms-scroll:                   Control File Format.
  772. * forms-mode-hooks:                     Forms Mode Commands.
  773. * forms-multi-line:                     Control File Format.
  774. * forms-number-of-fields:               Control File Format.
  775. * forms-read-only:                      Control File Format.
  776. * forms-version:                        Miscellaneous.
  777.  
  778. 
  779. File: forms,  Node: Function Index,  Prev: Variable Index,  Up: Top
  780.  
  781. Function Index
  782. **************
  783.  
  784. * Menu:
  785.  
  786. * beginning-of-buffer:                  Forms Mode Commands.
  787. * describe-mode:                        Forms Mode Commands.
  788. * end-of-buffer:                        Forms Mode Commands.
  789. * eval-current-buffer:                  Control File Format.
  790. * forms-delete-record:                  Forms Mode Commands.
  791. * forms-edit-mode:                      Forms Mode Commands.
  792. * forms-enumerate:                      Miscellaneous.
  793. * forms-exit:                           Forms Mode Commands.
  794. * forms-exit-no-save:                   Forms Mode Commands.
  795. * forms-find-file:                      Forms Mode Commands.
  796. * forms-find-file-other-window:         Forms Mode Commands.
  797. * forms-first-record:                   Forms Mode Commands.
  798. * forms-insert-record:                  Forms Mode Commands.
  799. * forms-jump-record:                    Forms Mode Commands.
  800. * forms-last-record:                    Forms Mode Commands.
  801. * forms-modified-record-filter:         Modifying Forms Contents.
  802. * forms-modified-record-filter:         Control File Format.
  803. * forms-new-record-filter:              Control File Format.
  804. * forms-next-field:                     Forms Mode Commands.
  805. * forms-next-record:                    Forms Mode Commands.
  806. * forms-prev-record:                    Forms Mode Commands.
  807. * forms-search:                         Forms Mode Commands.
  808. * forms-view-mode:                      Forms Mode Commands.
  809. * revert-buffer:                        Forms Mode Commands.
  810. * save-buffer:                          Forms Mode Commands.
  811. * scroll-down:                          Forms Mode Commands.
  812. * scroll-up:                            Forms Mode Commands.
  813.  
  814.  
  815. 
  816. Tag Table:
  817. Node: Top337
  818. Node: What is in a Forms1615
  819. Node: Data File Format2652
  820. Node: Control File Format3368
  821. Node: Forms Format Description6352
  822. Node: Modifying Forms Contents9286
  823. Node: Forms Mode Commands10941
  824. Node: Key Bindings16738
  825. Node: Miscellaneous17694
  826. Node: Error Messages19457
  827. Node: Examples22244
  828. Node: Credits25306
  829. Node: Concept Index26092
  830. Node: Variable Index26320
  831. Node: Function Index27312
  832. 
  833. End Tag Table
  834.