2 Entering and Exiting Forms Mode

M-x forms-find-file RET control-file RET

Visit a database using Forms mode. Specify the name of the control file, not the data file!

M-x forms-find-file-other-window RET control-file RET

Similar, but displays the file in another window.

The command forms-find-file evaluates the file control-file, and also visits it in Forms mode. What you see in its buffer is not the contents of this file, but rather a single record of the corresponding data file that is visited in its own buffer. So there are two buffers involved in Forms mode: the forms buffer that is initially used to visit the control file and that shows the records being browsed, and the data buffer that holds the data file 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 ‘Forms’, followed by the minor mode ‘View’ if the data base is read-only. The number of the current record (n) and the total number of records in the file(t) are shown in the mode line as ‘n/t’. For example:

--%%-Emacs: passwd-demo          (Forms View 1/54)----All-------

If the buffer is not read-only, you may change the buffer to modify the fields in the record. When you move to a different record, the contents of the buffer are parsed using the specifications in forms-format-list, and the data file is updated. If the record has fields that aren’t included in the display, they are not changed.

Entering Forms mode runs the normal hook forms-mode-hook to perform user-defined customization.

To save any modified data, you can use C-x C-s (forms-save-buffer). This does not save the forms buffer (which would be rather useless), but instead saves the buffer visiting the data file.

To terminate Forms mode, you can use C-x C-s (forms-save-buffer) and then kill the forms buffer. However, the data buffer will still remain. If this is not desired, you have to kill this buffer too.