comparison lisp/forms.el @ 13984:c045b6e55d08

(forms-toggle-read-only, forms-enumerate): Doc fix.
author Karl Heuer <kwzh@gnu.org>
date Thu, 04 Jan 1996 23:38:16 +0000
parents 438ebe3b6f8d
children 83f275dcd93a
comparison
equal deleted inserted replaced
13983:292411768ad9 13984:c045b6e55d08
38 ;;; === How it works === 38 ;;; === How it works ===
39 ;;; 39 ;;;
40 ;;; Forms mode means visiting a data file which is supposed to consist 40 ;;; Forms mode means visiting a data file which is supposed to consist
41 ;;; of records each containing a number of fields. The records are 41 ;;; of records each containing a number of fields. The records are
42 ;;; separated by a newline, the fields are separated by a user-defined 42 ;;; separated by a newline, the fields are separated by a user-defined
43 ;;; field separater (default: TAB). 43 ;;; field separator (default: TAB).
44 ;;; When shown, a record is transferred to an Emacs buffer and 44 ;;; When shown, a record is transferred to an Emacs buffer and
45 ;;; presented using a user-defined form. One record is shown at a 45 ;;; presented using a user-defined form. One record is shown at a
46 ;;; time. 46 ;;; time.
47 ;;; 47 ;;;
48 ;;; Forms mode is a composite mode. It involves two files, and two 48 ;;; Forms mode is a composite mode. It involves two files, and two
52 ;;; present the forms. 52 ;;; present the forms.
53 ;;; The second file holds the actual data. The buffer of this file 53 ;;; The second file holds the actual data. The buffer of this file
54 ;;; will be buried, for it is never accessed directly. 54 ;;; will be buried, for it is never accessed directly.
55 ;;; 55 ;;;
56 ;;; Forms mode is invoked using M-x forms-find-file control-file . 56 ;;; Forms mode is invoked using M-x forms-find-file control-file .
57 ;;; Alternativily `forms-find-file-other-window' can be used. 57 ;;; Alternatively `forms-find-file-other-window' can be used.
58 ;;; 58 ;;;
59 ;;; You may also visit the control file, and switch to forms mode by hand 59 ;;; You may also visit the control file, and switch to forms mode by hand
60 ;;; with M-x forms-mode . 60 ;;; with M-x forms-mode .
61 ;;; 61 ;;;
62 ;;; Automatic mode switching is supported if you specify 62 ;;; Automatic mode switching is supported if you specify
112 ;;; If non-null the records of the data file may 112 ;;; If non-null the records of the data file may
113 ;;; contain fields that can span multiple lines in 113 ;;; contain fields that can span multiple lines in
114 ;;; the form. 114 ;;; the form.
115 ;;; This variable denotes the separator character 115 ;;; This variable denotes the separator character
116 ;;; to be used for this purpose. Upon display, all 116 ;;; to be used for this purpose. Upon display, all
117 ;;; occurrencies of this character are translated 117 ;;; occurrences of this character are translated
118 ;;; to newlines. Upon storage they are translated 118 ;;; to newlines. Upon storage they are translated
119 ;;; back to the separator character. 119 ;;; back to the separator character.
120 ;;; 120 ;;;
121 ;;; forms-forms-scroll [bool, default nil] 121 ;;; forms-forms-scroll [bool, default nil]
122 ;;; Non-nil means: rebind locally the commands that 122 ;;; Non-nil means: rebind locally the commands that
195 ;;; 195 ;;;
196 ;;; When a form is changed the record is updated as soon as this form 196 ;;; When a form is changed the record is updated as soon as this form
197 ;;; is left. The contents of the form are parsed using information 197 ;;; is left. The contents of the form are parsed using information
198 ;;; obtained from `forms-format-list', and the fields which are 198 ;;; obtained from `forms-format-list', and the fields which are
199 ;;; deduced from the form are modified. Fields not shown on the forms 199 ;;; deduced from the form are modified. Fields not shown on the forms
200 ;;; retain their origional values. The newly formed record then 200 ;;; retain their original values. The newly formed record then
201 ;;; replaces the contents of the old record in `forms--file-buffer'. 201 ;;; replaces the contents of the old record in `forms--file-buffer'.
202 ;;; A parse routine `forms--parser' is built upon startup to parse 202 ;;; A parse routine `forms--parser' is built upon startup to parse
203 ;;; the records. 203 ;;; the records.
204 ;;; 204 ;;;
205 ;;; Two exit functions exist: `forms-exit' and `forms-exit-no-save'. 205 ;;; Two exit functions exist: `forms-exit' and `forms-exit-no-save'.
286 ;;; Global variables and constants: 286 ;;; Global variables and constants:
287 287
288 (provide 'forms) ;;; official 288 (provide 'forms) ;;; official
289 (provide 'forms-mode) ;;; for compatibility 289 (provide 'forms-mode) ;;; for compatibility
290 290
291 (defconst forms-version (substring "$Revision: 2.22 $" 11 -2) 291 (defconst forms-version (substring "$Revision: 2.23 $" 11 -2)
292 "The version number of forms-mode (as string). The complete RCS id is: 292 "The version number of forms-mode (as string). The complete RCS id is:
293 293
294 $Id: forms.el,v 2.22 1995/10/30 17:07:02 rms Exp jvromans $") 294 $Id: forms.el,v 2.23 1995/11/16 20:04:57 jvromans Exp kwzh $")
295 295
296 (defvar forms-mode-hooks nil 296 (defvar forms-mode-hooks nil
297 "Hook functions to be run upon entering Forms mode.") 297 "Hook functions to be run upon entering Forms mode.")
298 298
299 ;;; Mandatory variables - must be set by evaluating the control file. 299 ;;; Mandatory variables - must be set by evaluating the control file.
699 ;; concatenated. 699 ;; concatenated.
700 ;; Array `forms--elements' is constructed that contains the order 700 ;; Array `forms--elements' is constructed that contains the order
701 ;; of the fields on the display. This array is used by 701 ;; of the fields on the display. This array is used by
702 ;; `forms--parser-using-text-properties' to extract the fields data 702 ;; `forms--parser-using-text-properties' to extract the fields data
703 ;; from the form on the screen. 703 ;; from the form on the screen.
704 ;; Upon completion, `forms-format-list' is garanteed correct, so 704 ;; Upon completion, `forms-format-list' is guaranteed correct, so
705 ;; `forms--make-format' and `forms--make-parser' do not need to perform 705 ;; `forms--make-format' and `forms--make-parser' do not need to perform
706 ;; any checks. 706 ;; any checks.
707 707
708 ;; Verify that `forms-format-list' is not nil. 708 ;; Verify that `forms-format-list' is not nil.
709 (or forms-format-list 709 (or forms-format-list
1704 ;;; Other commands 1704 ;;; Other commands
1705 1705
1706 (defun forms-toggle-read-only (arg) 1706 (defun forms-toggle-read-only (arg)
1707 "Toggles read-only mode of a forms mode buffer. 1707 "Toggles read-only mode of a forms mode buffer.
1708 With an argument, enables read-only mode if the argument is positive. 1708 With an argument, enables read-only mode if the argument is positive.
1709 Otherwise enables edit mode if the visited file is writeable." 1709 Otherwise enables edit mode if the visited file is writable."
1710 1710
1711 (interactive "P") 1711 (interactive "P")
1712 1712
1713 (if (if arg 1713 (if (if arg
1714 ;; Negative arg means switch it off. 1714 ;; Negative arg means switch it off.
1982 ;;; Special service 1982 ;;; Special service
1983 ;;; 1983 ;;;
1984 (defun forms-enumerate (the-fields) 1984 (defun forms-enumerate (the-fields)
1985 "Take a quoted list of symbols, and set their values to sequential numbers. 1985 "Take a quoted list of symbols, and set their values to sequential numbers.
1986 The first symbol gets number 1, the second 2 and so on. 1986 The first symbol gets number 1, the second 2 and so on.
1987 It returns the higest number. 1987 It returns the highest number.
1988 1988
1989 Usage: (setq forms-number-of-fields 1989 Usage: (setq forms-number-of-fields
1990 (forms-enumerate 1990 (forms-enumerate
1991 '(field1 field2 field2 ...)))" 1991 '(field1 field2 field2 ...)))"
1992 1992