\input texinfo @c -*-texinfo-*-@c documentation for forms-mode@c Written by Johan Vromans, and edited by Richard Stallman@comment %**start of header (This is for running Texinfo on a region.)@setfilename ../info/forms@settitle Forms Mode User's Manual@syncodeindex vr cp@syncodeindex fn cp@syncodeindex ky cp@iftex@finalout@setchapternewpage odd@end iftex@c @smallbook@comment %**end of header (This is for running Texinfo on a region.)@copyingThis file documents Forms mode, a form-editing major mode for GNU Emacs.Copyright @copyright{} 1989, 1997, 2001, 2002, 2003, 2004,2005, 2006, 2007 Free Software Foundation, Inc.@quotationPermission is granted to copy, distribute and/or modify this documentunder the terms of the GNU Free Documentation License, Version 1.2 orany later version published by the Free Software Foundation; with noInvariant Sections, with the Front-Cover texts being ``A GNUManual,'' and with the Back-Cover Texts as in (a) below. A copy of thelicense is included in the section entitled ``GNU Free DocumentationLicense'' in the Emacs manual.(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modifythis GNU Manual, like GNU software. Copies published by the FreeSoftware Foundation raise funds for GNU development.''This document is part of a collection distributed under the GNU FreeDocumentation License. If you want to distribute this documentseparately from the collection, you can do so by adding a copy of thelicense to the document, as described in section 6 of the license.@end quotation@end copying@dircategory Emacs@direntry* Forms: (forms). Emacs package for editing data bases by filling in forms.@end direntry@titlepage@sp 6@center @titlefont{Forms Mode User's Manual}@sp 4@center Forms-Mode version 2@sp 1@center for GNU Emacs 22.1@sp 1@center April 2007@sp 5@center Johan Vromans@center @i{jvromans@@squirrel.nl}@page@vskip 0pt plus 1filll@insertcopying@end titlepage@ifnottex@node Top@top Forms ModeForms mode is an Emacs major mode for working with simple textual databases in a forms-oriented manner. In Forms mode, the information inthese files is presented in an Emacs window in a user-defined format,one record at a time. The user can view records or modify theircontents.Forms mode is not a simple major mode, but requires two files to do itsjob: a control file and a data file. The data file holds theactual data to be presented. The control file describeshow to present it.@menu* Forms Example:: An example: editing the password data base.* Entering and Exiting Forms Mode:: How to visit a file in Forms mode.* Forms Commands:: Special commands to use while in Forms mode.* Data File Format:: How to format the data file.* Control File Format:: How to control forms mode.* Format Description:: How to define the forms layout.* Modifying Forms Contents:: How to modify.* Miscellaneous:: Forms mode messages and other remarks.* Error Messages:: List of error messages forms mode can produce.* Long Example:: A more complex control file example.* GNU Free Documentation License:: The license for this documentation.* Credits:: Thanks everyone.* Index:: Index to this manual.@end menu@end ifnottex@node Forms Example@chapter Forms ExampleLet's illustrate Forms mode with an example. Suppose you are looking atthe @file{/etc/passwd} file, and the screen looks like this:@example====== /etc/passwd ======User : root Uid: 0 Gid: 1Name : Super UserHome : /Shell: /bin/sh@end exampleAs you can see, the familiar fields from the entry for the super userare all there, but instead of being colon-separated on one single line,they make up a forms.The contents of the forms consist of the contents of the fields of therecord (e.g. @samp{root}, @samp{0}, @samp{1}, @samp{Super User})interspersed with normal text (e.g @samp{User : }, @samp{Uid: }).If you modify the contents of the fields, Forms mode will analyze yourchanges and update the file appropriately. You cannot modify theinterspersed explanatory text (unless you go to some trouble about it),because that is marked read-only (@pxref{Text Properties,,, elisp, TheEmacs Lisp Reference Manual}).The Forms mode control file specifies the relationship between theformat of @file{/etc/passwd} and what appears on the screen in Formsmode. @xref{Control File Format}.@node Entering and Exiting Forms Mode@chapter Entering and Exiting Forms Mode@table @kbd@findex forms-find-file@item M-x forms-find-file @key{RET} @var{control-file} @key{RET}Visit a database using Forms mode. Specify the name of the@strong{control file}, not the data file!@findex forms-find-file-other-window@item M-x forms-find-file-other-window @key{RET} @var{control-file} @key{RET}Similar, but displays the file in another window.@end tableThe command @code{forms-find-file} evaluates the file@var{control-file}, and also visits it in Forms mode. What you see inits buffer is not the contents of this file, but rather a single recordof the corresponding data file that is visited in its own buffer. Sothere are two buffers involved in Forms mode: the @dfn{forms buffer}that is initially used to visit the control file and that shows therecords being browsed, and the @dfn{data buffer} that holds the datafile being visited. The latter buffer is normally not visible.Initially, the first record is displayed in the forms buffer.The mode line displays the major mode name @samp{Forms}, followed by theminor mode @samp{View} if the data base is read-only. The number of thecurrent record (@var{n}) and the total number of records in thefile(@var{t}) are shown in the mode line as @samp{@var{n}/@var{t}}. Forexample:@example--%%-Emacs: passwd-demo (Forms View 1/54)----All-------@end exampleIf the buffer is not read-only, you may change the buffer to modify thefields in the record. When you move to a different record, the contentsof the buffer are parsed using the specifications in@code{forms-format-list}, and the data file is updated. If the recordhas fields that aren't included in the display, they are not changed.@vindex forms-mode-hooksEntering Forms mode runs the normal hook @code{forms-mode-hooks} toperform user-defined customization.To save any modified data, you can use @kbd{C-x C-s}(@code{forms-save-buffer}). This does not save the forms buffer (which wouldbe rather useless), but instead saves the buffer visiting the data file.To terminate Forms mode, you can use @kbd{C-x C-s} (@code{forms-save-buffer})and then kill the forms buffer. However, the data buffer will stillremain. If this is not desired, you have to kill this buffer too.@node Forms Commands@chapter Forms CommandsThe commands of Forms mode belong to the @kbd{C-c} prefix, with oneexception: @key{TAB}, which moves to the next field. Forms mode usesdifferent key maps for normal mode and read-only mode. In read-onlyForms mode, you can access most of the commands without the @kbd{C-c}prefix, but you must type ordinary letters instead of controlcharacters; for example, type @kbd{n} instead of @kbd{C-c C-n}.If your Emacs has been built with X-toolkit support, Forms mode willprovide its own menu with a number of Forms mode commands.@table @kbd@findex forms-next-record@kindex C-c C-n@item C-c C-nShow the next record (@code{forms-next-record}). With a numericargument @var{n}, show the @var{n}th next record.@findex forms-prev-record@kindex C-c C-p@item C-c C-pShow the previous record (@code{forms-prev-record}). With a numericargument @var{n}, show the @var{n}th previous record.@findex forms-jump-record@kindex C-c C-l@item C-c C-lJump to a record by number (@code{forms-jump-record}). Specifythe record number with a numeric argument.@findex forms-first-record@kindex C-c <@item C-c <Jump to the first record (@code{forms-first-record}).@findex forms-last-record@kindex C-c >@item C-c >Jump to the last record (@code{forms-last-record}). This command alsorecalculates the number of records in the data file.@findex forms-next-field@kindex TAB@item @key{TAB}@kindex C-c TAB@itemx C-c @key{TAB}Jump to the next field in the current record (@code{forms-next-field}).With a numeric argument @var{n}, jump forward @var{n} fields. If this commandwould move past the last field, it wraps around to the first field.@findex forms-toggle-read-only@kindex C-c C-q@item C-c C-qToggles read-only mode (@code{forms-toggle-read-only}). In read-onlyForms mode, you cannot edit the fields; most Forms mode commands can beaccessed without the prefix @kbd{C-c} if you use the normal letterinstead (for example, type @kbd{n} instead of @kbd{C-c C-n}). In editmode, you can edit the fields and thus change the contents of the database; you must begin Forms mode commands with @code{C-c}. Switchingto edit mode is allowed only if you have write access to the data file.@findex forms-insert-record@kindex C-c C-o@item C-c C-oCreate a new record and insert it before the current record(@code{forms-insert-record}). It starts out with empty (or default)contents for its fields; you can then edit the fields. With a numericargument, the new record is created @emph{after} the current one.See also @code{forms-modified-record-filter} in @ref{Modifying FormsContents}.@findex forms-delete-record@kindex C-c C-k@item C-c C-kDelete the current record (@code{forms-delete-record}). You areprompted for confirmation before the record is deleted unless a numericargument has been provided.@findex forms-search-forward@kindex C-c C-s @var{regexp} @key{RET}@item C-c C-s @var{regexp} @key{RET}Search forward for @var{regexp} in all records following this one(@code{forms-search-forward}). If found, this record is shown.If you give an empty argument, the previous regexp is used again.@findex forms-search-backward@kindex C-c C-r @var{regexp} @key{RET}@item C-c C-r @var{regexp} @key{RET}Search backward for @var{regexp} in all records following this one(@code{forms-search-backward}). If found, this record is shown.If you give an empty argument, the previous regexp is used again.@ignore@findex forms-exit@kindex C-c C-x@item C-c C-xTerminate Forms mode processing (@code{forms-exit}). The data file issaved if it has been modified.@findex forms-exit-no-save@item M-x forms-exit-no-saveTerminates forms mode processing without saving modified data first.@end ignore@findex forms-prev-field@item M-x forms-prev-fieldSimilar to @code{forms-next-field} but moves backwards.@findex forms-save-buffer@item M-x forms-save-buffer@kindex C-x C-s@itemx C-x C-sForms mode replacement for @code{save-buffer}. When executed in theforms buffer it will save the contents of the (modified) data bufferinstead. In Forms mode this function will be bound to @kbd{C-x C-s}.@findex forms-print@item M-x forms-printThis command can be used to make a formatted printof the contents of the data file.@end tableIn addition the command @kbd{M-x revert-buffer} is useful in Forms modejust as in other modes.@ignore@vindex forms-forms-scroll@findex scroll-up@findex scroll-downIf the variable @code{forms-forms-scrolls} is set to a value otherthan @code{nil} (which it is, by default), the Emacs functions@code{scroll-up} and @code{scroll-down} will perform a@code{forms-next-record} and @code{forms-prev-record} when in formsmode. So you can use your favorite page commands to page through thedata file.@vindex forms-forms-jump@findex beginning-of-buffer@findex end-of-bufferLikewise, if the variable @code{forms-forms-jump} is not @code{nil}(which it is, by default), Emacs functions @code{beginning-of-buffer}and @code{end-of-buffer} will perform @code{forms-first-record} and@code{forms-last-record} when in forms mode.@end ignoreThe following function key definitions are set up in Forms mode(whether read-only or not):@table @kbd@kindex next@item nextforms-next-record@kindex prior@item priorforms-prev-record@kindex begin@item beginforms-first-record@kindex end@item endforms-last-record@kindex S-Tab@findex forms-prev-field@item S-Tabforms-prev-field@end table@node Data File Format@chapter Data File Format@cindex record@cindex field@vindex forms-field-sepFiles for use with Forms mode are very simple---each @dfn{record}(usually one line) forms the contents of one form. Each record consistsof a number of @dfn{fields}, which are separated by the value of thestring @code{forms-field-sep}, which is @code{"\t"} (a Tab) by default.@vindex forms-read-file-filter@vindex forms-write-file-filterIf the format of the data file is not suitable enough you can define thefilter functions @code{forms-read-file-filter} and@code{forms-write-file-filter}. @code{forms-read-file-filter} is calledwhen the data file is read from disk into the data buffer. It operateson the data buffer, ignoring read-only protections. When the data fileis saved to disk @code{forms-write-file-filter} is called to cancel theeffects of @code{forms-read-file-filter}. After being saved,@code{forms-read-file-filter} is called again to prepare the data bufferfor further processing.@cindex pseudo-newline@vindex forms-multi-lineFields may contain text which shows up in the forms in multiple lines.These lines are separated in the field using a ``pseudo-newline''character which is defined by the value of the string@code{forms-multi-line}. Its default value is @code{"\^k"} (a Control-Kcharacter). If it isset to @code{nil}, multiple line fields are prohibited.If the data file does not exist, it is automatically created.@node Control File Format@chapter Control File Format@cindex control fileThe Forms mode @dfn{control file} serves two purposes. First, it namesthe data file to use, and defines its format and properties. Second,the Emacs buffer it occupies is used by Forms mode to display the forms.The contents of the control file are evaluated as a Lisp program. Itshould set the following Lisp variables to suitable values:@table @code@vindex forms-file@item forms-fileThis variable specifies the name of the data file. Example:@example(setq forms-file "my/data-file")@end exampleIf the control file doesn't set @code{forms-file}, Forms modereports an error.@vindex forms-format-list@item forms-format-listThis variable describes the way the fields of the record are formatted onthe screen. For details, see @ref{Format Description}.@vindex forms-number-of-fields@item forms-number-of-fieldsThis variable holds the number of fields in each record of the datafile. Example:@example(setq forms-number-of-fields 10)@end example@end tableIf the control file does not set @code{forms-format-list} a defaultformat is used. In this situation, Forms mode will deduce the number offields from the data file providing this file exists and@code{forms-number-of-records} has not been set in the control file.The control file can optionally set the following additional Forms modevariables. Most of them have default values that are good for mostapplications.@table @code@vindex forms-field-sep@item forms-field-sepThis variable may be used to designate the string which separates thefields in the records of the data file. If not set, it defaults to thestring @code{"\t"} (a Tab character). Example:@example(setq forms-field-sep "\t")@end example@vindex forms-read-only@item forms-read-onlyIf the value is non-@code{nil}, the data file is treated read-only. (Formsmode also treats the data file as read-only if you don't have access towrite it.) Example:@example(set forms-read-only t)@end example@vindex forms-multi-line@item forms-multi-lineThis variable specifies the @dfn{pseudo newline} separator that allowsmulti-line fields. This separator goes between the ``lines'' within afield---thus, the field doesn't really contain multiple lines, but itappears that way when displayed in Forms mode. If the value is@code{nil}, multi-line text fields are prohibited. The pseudo newlinemust not be a character contained in @code{forms-field-sep}.The default value is @code{"\^k"}, the character Control-K. Example:@example(setq forms-multi-line "\^k")@end example@ignore@vindex forms-forms-scroll@item forms-forms-scroll@xref{Forms Mode Commands}, for details.@vindex forms-forms-jump@item forms-forms-jump@xref{Forms Mode Commands}, for details.@end ignore@findex forms-read-file-filter@item forms-read-file-filterThis variable holds the name of a function to be called after the datafile has been read in. This can be used to transform the contents of thedata file into a format more suitable for forms processing.If it is @code{nil}, no function is called. For example, to maintain agzipped database:@example(defun gzip-read-file-filter () (shell-command-on-region (point-min) (point-max) "gzip -d" t t))(setq forms-read-file-filter 'gzip-read-file-filter)@end example@findex forms-write-file-filter@item forms-write-file-filterThis variable holds the name of a function to be called before writingout the contents of the data file.This can be used to undo the effects of @code{forms-read-file-filter}.If it is @code{nil}, no function is called. Example:@example(defun gzip-write-file-filter () (make-variable-buffer-local 'require-final-newline) (setq require-final-newline nil) (shell-command-on-region (point-min) (point-max) "gzip" t t))(setq forms-write-file-filter 'gzip-write-file-filter)@end example@findex forms-new-record-filter@item forms-new-record-filterThis variable holds a function to be called whenever a new record is createdto supply default values for fields. If it is @code{nil}, no function iscalled.@xref{Modifying Forms Contents}, for details.@findex forms-modified-record-filter@item forms-modified-record-filterThis variable holds a function to be called whenever a record ismodified, just before updating the Forms data file. If it is@code{nil}, no function is called.@xref{Modifying Forms Contents}, for details.@findex forms-insert-after@item forms-insert-afterIf this variable is not @code{nil}, new records are created @emph{after} thecurrent record. Also, upon visiting a file, the initial position will beat the last record instead of the first one.@findex forms-check-number-of-fields@item forms-check-number-of-fieldsNormally each record is checked to contain the correct number of fields.Under certain circumstances, this can be undesirable.If this variable is set to @code{nil}, these checks will be bypassed.@end table@node Format Description@chapter The Format Description@vindex forms-format-list The variable @code{forms-format-list} specifies the format of the datain the data file, and how to convert the data for display in Forms mode.Its value must be a list of Forms mode @dfn{formatting elements}, eachof which can be a string, a number, a Lisp list, or a Lisp symbol thatevaluates to one of those. The formatting elements are processed in theorder they appear in the list.@table @var@item stringA string formatting element is inserted in the forms ``as is,'' as textthat the user cannot alter.@item numberA number element selects a field of the record. The contents of thisfield are inserted in the display at this point. Field numbers countstarting from 1 (one).@item listA formatting element that is a list specifies a function call. Thisfunction is called every time a record is displayed, and its result,which must be a string, is inserted in the display text. The functionshould do nothing but returning a string.@vindex forms-fieldsThe function you call can access the fields of the record as a list inthe variable@code{forms-fields}.@item symbolA symbol used as a formatting element should evaluate to a string, number,or list; the value is interpreted as a formatting element, as describedabove.@end tableIf a record does not contain the number of fields as specified in@code{forms-number-of-fields}, a warning message will be printed. Excessfields are ignored, missing fields are set to empty.The control file which displays @file{/etc/passwd} file as demonstratedin the beginning of this manual might look as follows:@example;; @r{This demo visits @file{/etc/passwd}.}(setq forms-file "/etc/passwd")(setq forms-number-of-fields 7)(setq forms-read-only t) ; @r{to make sure}(setq forms-field-sep ":");; @r{Don't allow multi-line fields.}(setq forms-multi-line nil)(setq forms-format-list (list "====== /etc/passwd ======\n\n" "User : " 1 " Uid: " 3 " Gid: " 4 "\n\n" "Name : " 5 "\n\n" "Home : " 6 "\n\n" "Shell: " 7 "\n"))@end exampleWhen you construct the value of @code{forms-format-list}, you shouldusually either quote the whole value, like this,@example(setq forms-format-list '( "====== " forms-file " ======\n\n" "User : " 1 (make-string 20 ?-) @dots{} ))@end example@noindentor quote the elements which are lists, like this:@example(setq forms-format-list (list "====== " forms-file " ======\n\n" "User : " 1 '(make-string 20 ?-) @dots{} ))@end exampleForms mode validates the contents of @code{forms-format-list} when youvisit a database. If there are errors, processing is aborted with anerror message which includes a descriptive text. @xref{Error Messages},for a detailed list of error messages.If no @code{forms-format-list} is specified, Forms mode will supply adefault format list. This list contains the name of the file beingvisited, and a simple label for each field indicating the field number.@node Modifying Forms Contents@chapter Modifying The Forms ContentsIf @code{forms-read-only} is @code{nil}, the user can modify the fieldsand records of the database.All normal editing commands are available for editing the contents of thedisplayed record. You cannot delete or modify the fixed, explanatorytext that comes from string formatting elements, but you can modify theactual field contents.@ignore@c This is for the Emacs 18 version only.If the contents of the forms cannot be recognized properly, this issignaled using a descriptive text. @xref{Error Messages}, for more info.The cursor will indicate the last part of the forms which wassuccessfully parsed. It's important to avoid entering field contentsthat would cause confusion with the field-separating fixed text.@end ignoreIf the variable @code{forms-modified-record-filter} is non-@code{nil},it is called as a function before the new data is written to the datafile. The function receives one argument, a vector that contains thecontents of the fields of the record.The function can refer to fields with @code{aref} and modify them with@code{aset}. The first field has number 1 (one); thus, element 0 of thevector is not used. The function should return the same vector it waspassed; the (possibly modified) contents of the vector determine what isactually written in the file. Here is an example:@example(defun my-modified-record-filter (record) ;; @r{Modify second field.} (aset record 2 (current-time-string)) ;; @r{Return the field vector.} record)(setq forms-modified-record-filter 'my-modified-record-filter)@end exampleIf the variable @code{forms-new-record-filter} is non-@code{nil}, itsvalue is a function to be called to fill in default values for thefields of a new record. The function is passed a vector of emptystrings, one for each field; it should return the same vector, withthe desired field values stored in it. Fields are numbered startingfrom 1 (one). Example:@example(defun my-new-record-filter (fields) (aset fields 5 (login-name)) (aset fields 1 (current-time-string)) fields)(setq forms-new-record-filter 'my-new-record-filter)@end example@node Miscellaneous@chapter Miscellaneous@vindex forms-versionThe global variable @code{forms-version} holds the version informationof the Forms mode software.@findex forms-enumerateIt is very convenient to use symbolic names for the fields in a record.The function @code{forms-enumerate} provides an elegant means to definea series of variables whose values are consecutive integers. Thefunction returns the highest number used, so it can be used to set@code{forms-number-of-fields} also. For example:@example(setq forms-number-of-fields (forms-enumerate '(field1 field2 field3 @dots{})))@end exampleThis sets @code{field1} to 1, @code{field2} to 2, and so on.Care has been taken to keep the Forms mode variables buffer-local, so itis possible to visit multiple files in Forms mode simultaneously, evenif they have different properties.@findex forms-modeIf you have visited the control file in normal fashion with@code{find-file} or a like command, you can switch to Forms mode withthe command @code{M-x forms-mode}. If you put @samp{-*- forms -*-} inthe first line of the control file, then visiting it enables Forms modeautomatically. But this makes it hard to edit the control file itself,so you'd better think twice before using this.The default format for the data file, using @code{"\t"} to separatefields and @code{"\^k"} to separate lines within a field, matches thefile format of some popular database programs, e.g. FileMaker. So@code{forms-mode} can decrease the need to use proprietary software.@node Error Messages@chapter Error MessagesThis section describes all error messages which can be generated byforms mode. Error messages that result from parsing the control fileall start with the text @samp{Forms control file error}. Messagesgenerated while analyzing the definition of @code{forms-format-list}start with @samp{Forms format error}.@table @code@item Forms control file error: `forms-file' has not been setThe variable @code{forms-file} was not set by the control file.@item Forms control file error: `forms-number-of-fields' has not been setThe variable @code{forms-number-of-fields} was not set by the controlfile.@item Forms control file error: `forms-number-of-fields' must be a number > 0The variable @code{forms-number-of-fields} did not contain a positivenumber.@item Forms control file error: `forms-field-sep' is not a string@itemx Forms control file error: `forms-multi-line' must be nil or a one-character stringThe variable @code{forms-multi-line} was set to something other than@code{nil} or a single-character string.@item Forms control file error: `forms-multi-line' is equal to 'forms-field-sep'The variable @code{forms-multi-line} may not be equal to@code{forms-field-sep} for this would make it impossible to distinguishfields and the lines in the fields.@item Forms control file error: `forms-new-record-filter' is not a function@itemx Forms control file error: `forms-modified-record-filter' is not a functionThe variable has been set to something else than a function.@item Forms control file error: `forms-format-list' is not a listThe variable @code{forms-format-list} was not set to a Lisp listby the control file.@item Forms format error: field number @var{xx} out of range 1..@var{nn}A field number was supplied in @code{forms-format-list} with a value of@var{xx}, which was not greater than zero and smaller than or equal tothe number of fields in the forms, @var{nn}.@item Forms format error: @var{fun} is not a functionThe first element of a list which is an element of@code{forms-format-list} was not a valid Lisp function.@item Forms format error: invalid element @var{xx}A list element was supplied in @code{forms-format-list} which was not astring, number or list.@ignore@c This applies to Emacs 18 only.@c Error messages generated while a modified form is being analyzed.@item Parse error: not looking at `...'When re-parsing the contents of a forms, the text shown could notbe found.@item Parse error: cannot find `...'When re-parsing the contents of a forms, the text shown, whichseparates two fields, could not be found.@item Parse error: cannot parse adjacent fields @var{xx} and @var{yy}Fields @var{xx} and @var{yy} were not separated by text, so could not beparsed again.@end ignore@item Warning: this record has @var{xx} fields instead of @var{yy}The number of fields in this record in the data file did not match@code{forms-number-of-fields}. Missing fields will be made empty.@item Multi-line fields in this record - update refused!The current record contains newline characters, hence can not be writtenback to the data file, for it would corrupt it. Probably you inserted anewline in a field, while @code{forms-multi-line} was @code{nil}.@item Field separator occurs in record - update refused!The current record contains the field separator string inside one of thefields. It can not be written back to the data file, for it wouldcorrupt it. Probably you inserted the field separator string in a field.@item Record number @var{xx} out of range 1..@var{yy}A jump was made to non-existing record @var{xx}. @var{yy} denotes thenumber of records in the file.@item Stuck at record @var{xx}An internal error prevented a specific record from being retrieved.@item No write access to @code{"}@var{file}@code{"}An attempt was made to enable edit mode on a file that has been writeprotected.@item Search failed: @var{regexp}The @var{regexp} could not be found in the data file. Forward searchingis done from the current location until the end of the file, thenretrying from the beginning of the file until the current location.Backward searching is done from the current location until the beginningof the file, then retrying from the end of the file until the currentlocation.@item WrappedA search completed successfully after wrapping around.@item Warning: number of records changed to @var{nn}Forms mode's idea of the number of records has been adjusted to thenumber of records actually present in the data file.@item Problem saving buffers?An error occurred while saving the data file buffer. Most likely, Emacsdid ask to confirm deleting the buffer because it had been modified, andyou said `no'.@end table@node Long Example@chapter Long ExampleThe following example exploits most of the features of Forms mode.This example is included in the distribution as file @file{forms-d2.el}.@example;; demo2 -- demo forms-mode -*- emacs-lisp -*-;; @r{This sample forms exploit most of the features of forms mode.};; @r{Set the name of the data file.}(setq forms-file "forms-d2.dat");; @r{Use @code{forms-enumerate} to set field names and number thereof.}(setq forms-number-of-fields (forms-enumerate '(arch-newsgroup ; 1 arch-volume ; 2 arch-issue ; and ... arch-article ; ... so arch-shortname ; ... ... on arch-parts arch-from arch-longname arch-keywords arch-date arch-remarks)));; @r{The following functions are used by this form for layout purposes.};;(defun arch-tocol (target &optional fill) "Produces a string to skip to column TARGET.Prepends newline if needed.The optional FILL should be a character, used to fill to the column." (if (null fill) (setq fill ? )) (if (< target (current-column)) (concat "\n" (make-string target fill)) (make-string (- target (current-column)) fill)));;(defun arch-rj (target field &optional fill) "Produces a string to skip to column TARGET\ minus the width of field FIELD.Prepends newline if needed.The optional FILL should be a character,used to fill to the column." (arch-tocol (- target (length (nth field forms-fields))) fill));; @r{Record filters.};;(defun new-record-filter (the-record) "Form a new record with some defaults." (aset the-record arch-from (user-full-name)) (aset the-record arch-date (current-time-string)) the-record) ; return it(setq forms-new-record-filter 'new-record-filter);; @r{The format list.}(setq forms-format-list (list "====== Public Domain Software Archive ======\n\n" arch-shortname " - " arch-longname "\n\n" "Article: " arch-newsgroup "/" arch-article " " '(arch-tocol 40) "Issue: " arch-issue " " '(arch-rj 73 10) "Date: " arch-date "\n\n" "Submitted by: " arch-from "\n" '(arch-tocol 79 ?-) "\n" "Keywords: " arch-keywords "\n\n" "Parts: " arch-parts "\n\n====== Remarks ======\n\n" arch-remarks ));; @r{That's all, folks!}@end example@node Credits@chapter CreditsBug fixes and other useful suggestions were supplied byHarald Hanche-Olsen (@code{hanche@@imf.unit.no}),@code{cwitty@@portia.stanford.edu},Jonathan I. Kamens,Per Cederqvist (@code{ceder@@signum.se}),Michael Lipka (@code{lipka@@lip.hanse.de}),Andy Piper (@code{ajp@@eng.cam.ac.uk}),Frederic Pierresteguy (@code{F.Pierresteguy@@frcl.bull.fr}),Ignatios Souvatzisand Richard Stallman (@code{rms@@gnu.org}).This documentation was slightly inspired by the documentation of ``rolomode'' by Paul Davis at Schlumberger Cambridge Research(@code{davis%scrsu1%sdr.slb.com@@relay.cs.net}).None of this would have been possible without GNU Emacs of the FreeSoftware Foundation. Thanks, Richard!@node GNU Free Documentation License@appendix GNU Free Documentation License@include doclicense.texi@node Index@unnumbered Index@printindex cp@contents@bye@ignore arch-tag: 2ac9810b-aa49-4ea6-8030-d7f1ecd467ed@end ignore