Mercurial > emacs
annotate lisp/forms.el @ 3952:f9dfc2872fb0
(describe_map_tree): Insert key_heading here.
New arg TITLE.
(describe_buffer_bindings): Corresponding changes.
(shadow_lookup): New function.
(describe_map_2): Call it. SHADOW is now a list of maps.
(describe_vector): Likewise.
(describe_map): SHADOW is now a list of maps.
(describe_map_tree): Likewise.
(describe_buffer_bindings): Build suitable list to pass as SHADOW.
(Faccessible_keymaps): New arg PREFIX. Callers changed.
(describe_map_tree): New arg PREFIX.
(Fdescribe_bindings): New arg PREFIX.
Pass to describe_buffer_bindings along with buffer.
(describe_buffer_bindings): Extract PREFIX and pass along.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 02 Jul 1993 05:21:05 +0000 |
parents | 93a7a7b97030 |
children | d8c9bc546c87 |
rev | line source |
---|---|
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
1 ;;; forms.el -- Forms mode: edit a file as a form to fill in. |
3828 | 2 ;;; Copyright (C) 1991, 1993 Free Software Foundation, Inc. |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
3 |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
4 ;; Author: Johan Vromans <jv@mh.nl> |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
5 ;; Version: 1.2.13 |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
6 |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
7 ;; This file is part of GNU Emacs. |
276 | 8 |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
9 ;; GNU Emacs is free software; you can redistribute it and/or modify |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
10 ;; it under the terms of the GNU General Public License as published by |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
11 ;; the Free Software Foundation; either version 2, or (at your option) |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
12 ;; any later version. |
276 | 13 |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
14 ;; GNU Emacs is distributed in the hope that it will be useful, |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
17 ;; GNU General Public License for more details. |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
18 |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
19 ;; You should have received a copy of the GNU General Public License |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
20 ;; along with GNU Emacs; see the file COPYING. If not, write to |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
21 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
22 |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
23 ;;; Commentary: |
276 | 24 |
25 ;;; Visit a file using a form. | |
26 ;;; | |
27 ;;; === Naming conventions | |
28 ;;; | |
29 ;;; The names of all variables and functions start with 'form-'. | |
30 ;;; Names which start with 'form--' are intended for internal use, and | |
31 ;;; should *NOT* be used from the outside. | |
32 ;;; | |
33 ;;; All variables are buffer-local, to enable multiple forms visits | |
34 ;;; simultaneously. | |
35 ;;; Variable 'forms--mode-setup' is local to *ALL* buffers, for it | |
36 ;;; controls if forms-mode has been enabled in a buffer. | |
37 ;;; | |
38 ;;; === How it works === | |
39 ;;; | |
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 | |
42 ;;; separated by a newline, the fields are separated by a user-defined | |
43 ;;; field separater (default: TAB). | |
44 ;;; When shown, a record is transferred to an emacs buffer and | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
45 ;;; presented using a user-defined form. One record is shown at a |
276 | 46 ;;; time. |
47 ;;; | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
48 ;;; Forms mode is a composite mode. It involves two files, and two |
276 | 49 ;;; buffers. |
50 ;;; The first file, called the control file, defines the name of the | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
51 ;;; data file and the forms format. This file buffer will be used to |
276 | 52 ;;; present the forms. |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
53 ;;; The second file holds the actual data. The buffer of this file |
276 | 54 ;;; will be buried, for it is never accessed directly. |
55 ;;; | |
56 ;;; Forms mode is invoked using "forms-find-file control-file". | |
57 ;;; Alternativily forms-find-file-other-window can be used. | |
58 ;;; | |
59 ;;; You may also visit the control file, and switch to forms mode by hand | |
60 ;;; with M-x forms-mode . | |
61 ;;; | |
62 ;;; Automatic mode switching is supported, so you may use "find-file" | |
63 ;;; if you specify "-*- forms -*-" in the first line of the control file. | |
64 ;;; | |
65 ;;; The control file is visited, evaluated using | |
66 ;;; eval-current-buffer, and should set at least the following | |
67 ;;; variables: | |
68 ;;; | |
69 ;;; forms-file [string] the name of the data file. | |
70 ;;; | |
71 ;;; forms-number-of-fields [integer] | |
72 ;;; The number of fields in each record. | |
73 ;;; | |
74 ;;; forms-format-list [list] formatting instructions. | |
75 ;;; | |
76 ;;; The forms-format-list should be a list, each element containing | |
77 ;;; | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
78 ;;; - a string, e.g. "hello" (which is inserted \"as is\"), |
276 | 79 ;;; |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
80 ;;; - an integer, denoting a field number. The contents of the field |
276 | 81 ;;; are inserted at this point. |
82 ;;; The first field has number one. | |
83 ;;; | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
84 ;;; - a function call, e.g. (insert "text"). This function call is |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
85 ;;; dynamically evaluated and should return a string. It should *NOT* |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
86 ;;; have side-effects on the forms being constructed. |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
87 ;;; The current fields are available to the function in the variable |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
88 ;;; forms-fields, they should *NOT* be modified. |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
89 ;;; |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
90 ;;; - a lisp symbol, that must evaluate to one of the above. |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
91 ;;; |
276 | 92 ;;; Optional variables which may be set in the control file: |
93 ;;; | |
94 ;;; forms-field-sep [string, default TAB] | |
95 ;;; The field separator used to separate the | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
96 ;;; fields in the data file. It may be a string. |
276 | 97 ;;; |
98 ;;; forms-read-only [bool, default nil] | |
99 ;;; 't' means that the data file is visited read-only. | |
100 ;;; If no write access to the data file is | |
101 ;;; possible, read-only mode is enforced. | |
102 ;;; | |
103 ;;; forms-multi-line [string, default "^K"] | |
104 ;;; If non-null the records of the data file may | |
105 ;;; contain fields which span multiple lines in | |
106 ;;; the form. | |
107 ;;; This variable denoted the separator character | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
108 ;;; to be used for this purpose. Upon display, all |
276 | 109 ;;; occurrencies of this character are translated |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
110 ;;; to newlines. Upon storage they are translated |
276 | 111 ;;; back to the separator. |
112 ;;; | |
113 ;;; forms-forms-scroll [bool, default t] | |
114 ;;; If non-nil: redefine scroll-up/down to perform | |
115 ;;; forms-next/prev-field if in forms mode. | |
116 ;;; | |
117 ;;; forms-forms-jump [bool, default t] | |
118 ;;; If non-nil: redefine beginning/end-of-buffer | |
119 ;;; to performs forms-first/last-field if in | |
120 ;;; forms mode. | |
121 ;;; | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
122 ;;; forms-new-record-filter [symbol, no default] |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
123 ;;; If defined: this should be the name of a |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
124 ;;; function that is called when a new |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
125 ;;; record is created. It can be used to fill in |
276 | 126 ;;; the new record with default fields, for example. |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
127 ;;; Instead of the name of the function, it may |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
128 ;;; be the function itself. |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
129 ;;; |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
130 ;;; forms-modified-record-filter [symbol, no default] |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
131 ;;; If defined: this should be the name of a |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
132 ;;; function that is called when a record has |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
133 ;;; been modified. It is called after the fields |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
134 ;;; are parsed. It can be used to register |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
135 ;;; modification dates, for example. |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
136 ;;; Instead of the name of the function, it may |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
137 ;;; be the function itself. |
276 | 138 ;;; |
139 ;;; After evaluating the control file, its buffer is cleared and used | |
140 ;;; for further processing. | |
141 ;;; The data file (as designated by "forms-file") is visited in a buffer | |
142 ;;; (forms--file-buffer) which will not normally be shown. | |
143 ;;; Great malfunctioning may be expected if this file/buffer is modified | |
144 ;;; outside of this package while it's being visited! | |
145 ;;; | |
146 ;;; A record from the data file is transferred from the data file, | |
147 ;;; split into fields (into forms--the-record-list), and displayed using | |
148 ;;; the specs in forms-format-list. | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
149 ;;; A format routine 'forms--format' is built upon startup to format |
276 | 150 ;;; the records. |
151 ;;; | |
152 ;;; When a form is changed the record is updated as soon as this form | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
153 ;;; is left. The contents of the form are parsed using forms-format-list, |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
154 ;;; and the fields which are deduced from the form are modified. So, |
276 | 155 ;;; fields not shown on the forms retain their origional values. |
156 ;;; The newly formed record and replaces the contents of the | |
157 ;;; old record in forms--file-buffer. | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
158 ;;; A parse routine 'forms--parser' is built upon startup to parse |
276 | 159 ;;; the records. |
160 ;;; | |
161 ;;; Two exit functions exist: forms-exit (which saves) and forms-exit-no-save | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
162 ;;; (which doesn't). However, if forms-exit-no-save is executed and the file |
276 | 163 ;;; buffer has been modified, emacs will ask questions. |
164 ;;; | |
165 ;;; Other functions are: | |
166 ;;; | |
167 ;;; paging (forward, backward) by record | |
168 ;;; jumping (first, last, random number) | |
169 ;;; searching | |
170 ;;; creating and deleting records | |
171 ;;; reverting the form (NOT the file buffer) | |
172 ;;; switching edit <-> view mode v.v. | |
173 ;;; jumping from field to field | |
174 ;;; | |
175 ;;; As an documented side-effect: jumping to the last record in the | |
176 ;;; file (using forms-last-record) will adjust forms--total-records if | |
177 ;;; needed. | |
178 ;;; | |
179 ;;; Commands and keymaps: | |
180 ;;; | |
181 ;;; A local keymap 'forms-mode-map' is used in the forms buffer. | |
182 ;;; As conventional, this map can be accessed with C-c prefix. | |
183 ;;; In read-only mode, the C-c prefix must be omitted. | |
184 ;;; | |
185 ;;; Default bindings: | |
186 ;;; | |
187 ;;; \C-c forms-mode-map | |
188 ;;; TAB forms-next-field | |
189 ;;; SPC forms-next-record | |
190 ;;; < forms-first-record | |
191 ;;; > forms-last-record | |
192 ;;; ? describe-mode | |
193 ;;; d forms-delete-record | |
194 ;;; e forms-edit-mode | |
195 ;;; i forms-insert-record | |
196 ;;; j forms-jump-record | |
197 ;;; n forms-next-record | |
198 ;;; p forms-prev-record | |
199 ;;; q forms-exit | |
200 ;;; s forms-search | |
201 ;;; v forms-view-mode | |
202 ;;; x forms-exit-no-save | |
203 ;;; DEL forms-prev-record | |
204 ;;; | |
3827
4089cf0e3f06
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3697
diff
changeset
|
205 ;;; The bindings of standard functions scroll-up, scroll-down, |
4089cf0e3f06
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3697
diff
changeset
|
206 ;;; beginning-of-buffer and end-of-buffer are locally replaced with |
4089cf0e3f06
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3697
diff
changeset
|
207 ;;; forms mode functions next/prev record and first/last |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
208 ;;; record. Buffer-local variables forms-forms-scroll and |
3827
4089cf0e3f06
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3697
diff
changeset
|
209 ;;; forms-forms-jump (default: t) may be set to nil to inhibit |
4089cf0e3f06
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3697
diff
changeset
|
210 ;;; rebinding. |
276 | 211 ;;; |
3827
4089cf0e3f06
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3697
diff
changeset
|
212 ;;; A local-write-file hook is defined to save the actual data file |
4089cf0e3f06
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3697
diff
changeset
|
213 ;;; instead of the buffer data, a revert-file-hook is defined to |
4089cf0e3f06
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3697
diff
changeset
|
214 ;;; revert a forms to original. |
276 | 215 ;;; |
216 ;;; For convenience, TAB is always bound to forms-next-field, so you | |
217 ;;; don't need the C-c prefix for this command. | |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
218 |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
219 ;;; Code: |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
220 |
276 | 221 ;;; Global variables and constants |
222 | |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
223 (provide 'forms) ;;; official |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
224 (provide 'forms-mode) ;;; for compatibility |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
225 |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
226 (defconst forms-version "1.2.13" |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
227 "Version of forms-mode implementation.") |
276 | 228 |
229 (defvar forms-mode-hooks nil | |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
230 "Hook functions to be run upon entering Forms mode.") |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
231 |
276 | 232 ;;; Mandatory variables - must be set by evaluating the control file |
233 | |
234 (defvar forms-file nil | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
235 "Name of the file holding the data.") |
276 | 236 |
237 (defvar forms-format-list nil | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
238 "List of formatting specifications.") |
276 | 239 |
240 (defvar forms-number-of-fields nil | |
241 "Number of fields per record.") | |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
242 |
276 | 243 ;;; Optional variables with default values |
244 | |
245 (defvar forms-field-sep "\t" | |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
246 "Field separator character (default TAB).") |
276 | 247 |
248 (defvar forms-read-only nil | |
249 "Read-only mode (defaults to the write access on the data file).") | |
250 | |
251 (defvar forms-multi-line "\C-k" | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
252 "Character to separate multi-line fields (default C-k).") |
276 | 253 |
254 (defvar forms-forms-scroll t | |
3828 | 255 "*Non-nil means replace scroll-up/down commands in Forms mode. |
256 The replacement commands performs forms-next/prev-record.") | |
276 | 257 |
258 (defvar forms-forms-jump t | |
3828 | 259 "*Non-nil means redefine beginning/end-of-buffer in Forms mode. |
260 The replacement commands performs forms-first/last-record.") | |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
261 |
276 | 262 ;;; Internal variables. |
263 | |
264 (defvar forms--file-buffer nil | |
265 "Buffer which holds the file data") | |
266 | |
267 (defvar forms--total-records 0 | |
268 "Total number of records in the data file.") | |
269 | |
270 (defvar forms--current-record 0 | |
271 "Number of the record currently on the screen.") | |
272 | |
273 (defvar forms-mode-map nil ; yes - this one is global | |
274 "Keymap for form buffer.") | |
275 | |
276 (defvar forms--markers nil | |
277 "Field markers in the screen.") | |
278 | |
279 (defvar forms--number-of-markers 0 | |
280 "Number of fields on screen.") | |
281 | |
282 (defvar forms--the-record-list nil | |
283 "List of strings of the current record, as parsed from the file.") | |
284 | |
285 (defvar forms--search-regexp nil | |
286 "Last regexp used by forms-search.") | |
287 | |
288 (defvar forms--format nil | |
289 "Formatting routine.") | |
290 | |
291 (defvar forms--parser nil | |
292 "Forms parser routine.") | |
293 | |
294 (defvar forms--mode-setup nil | |
295 "Internal - keeps track of forms-mode being set-up.") | |
296 (make-variable-buffer-local 'forms--mode-setup) | |
297 | |
298 (defvar forms--new-record-filter nil | |
299 "Internal - set if a new record filter has been defined.") | |
300 | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
301 (defvar forms--modified-record-filter nil |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
302 "Internal - set if a modified record filter has been defined.") |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
303 |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
304 (defvar forms--dynamic-text nil |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
305 "Internal - holds dynamic text to insert between fields.") |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
306 |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
307 (defvar forms-fields nil |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
308 "List with fields of the current forms. First field has number 1.") |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
309 |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
310 (defvar forms-new-record-filter |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
311 "The name of a function that is called when a new record is created.") |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
312 |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
313 (defvar forms-modified-record-filter |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
314 "The name of a function that is called when a record has been modified.") |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
315 |
276 | 316 ;;; forms-mode |
317 ;;; | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
318 ;;; This is not a simple major mode, as usual. Therefore, forms-mode |
276 | 319 ;;; takes an optional argument 'primary' which is used for the initial |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
320 ;;; set-up. Normal use would leave 'primary' to nil. |
276 | 321 ;;; |
322 ;;; A global buffer-local variable 'forms--mode-setup' has the same effect | |
323 ;;; but makes it possible to auto-invoke forms-mode using find-file. | |
324 ;;; | |
325 ;;; Note: although it seems logical to have (make-local-variable) executed | |
326 ;;; where the variable is first needed, I deliberately placed all calls | |
327 ;;; in the forms-mode function. | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
328 |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
329 ;;;###autoload |
276 | 330 (defun forms-mode (&optional primary) |
331 "Major mode to visit files in a field-structured manner using a form. | |
332 | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
333 Commands (prefix with C-c if not in read-only mode): |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
334 \\{forms-mode-map}" |
276 | 335 |
336 (interactive) ; no - 'primary' is not prefix arg | |
337 | |
338 ;; Primary set-up: evaluate buffer and check if the mandatory | |
339 ;; variables have been set. | |
340 (if (or primary (not forms--mode-setup)) | |
341 (progn | |
342 (kill-all-local-variables) | |
343 | |
344 ;; make mandatory variables | |
345 (make-local-variable 'forms-file) | |
346 (make-local-variable 'forms-number-of-fields) | |
347 (make-local-variable 'forms-format-list) | |
348 | |
349 ;; make optional variables | |
350 (make-local-variable 'forms-field-sep) | |
351 (make-local-variable 'forms-read-only) | |
352 (make-local-variable 'forms-multi-line) | |
353 (make-local-variable 'forms-forms-scroll) | |
354 (make-local-variable 'forms-forms-jump) | |
355 (fmakunbound 'forms-new-record-filter) | |
356 | |
357 ;; eval the buffer, should set variables | |
358 (eval-current-buffer) | |
359 | |
360 ;; check if the mandatory variables make sense. | |
361 (or forms-file | |
362 (error "'forms-file' has not been set")) | |
363 (or forms-number-of-fields | |
364 (error "'forms-number-of-fields' has not been set")) | |
365 (or (> forms-number-of-fields 0) | |
366 (error "'forms-number-of-fields' must be > 0") | |
367 (or (stringp forms-field-sep)) | |
368 (error "'forms-field-sep' is not a string")) | |
369 (if forms-multi-line | |
370 (if (and (stringp forms-multi-line) | |
371 (eq (length forms-multi-line) 1)) | |
372 (if (string= forms-multi-line forms-field-sep) | |
373 (error "'forms-multi-line' is equal to 'forms-field-sep'")) | |
374 (error "'forms-multi-line' must be nil or a one-character string"))) | |
375 | |
376 ;; validate and process forms-format-list | |
377 (make-local-variable 'forms--number-of-markers) | |
378 (make-local-variable 'forms--markers) | |
379 (forms--process-format-list) | |
380 | |
381 ;; build the formatter and parser | |
382 (make-local-variable 'forms--format) | |
383 (forms--make-format) | |
384 (make-local-variable 'forms--parser) | |
385 (forms--make-parser) | |
386 | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
387 ;; check if record filters are defined |
276 | 388 (make-local-variable 'forms--new-record-filter) |
389 (setq forms--new-record-filter | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
390 (cond |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
391 ((fboundp 'forms-new-record-filter) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
392 (symbol-function 'forms-new-record-filter)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
393 ((and (boundp 'forms-new-record-filter) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
394 (fboundp forms-new-record-filter)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
395 forms-new-record-filter))) |
276 | 396 (fmakunbound 'forms-new-record-filter) |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
397 (make-local-variable 'forms--modified-record-filter) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
398 (setq forms--modified-record-filter |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
399 (cond |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
400 ((fboundp 'forms-modified-record-filter) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
401 (symbol-function 'forms-modified-record-filter)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
402 ((and (boundp 'forms-modified-record-filter) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
403 (fboundp forms-modified-record-filter)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
404 forms-modified-record-filter))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
405 (fmakunbound 'forms-modified-record-filter) |
276 | 406 |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
407 ;; dynamic text support |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
408 (make-local-variable 'forms--dynamic-text) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
409 (make-local-variable 'forms-fields) |
276 | 410 |
411 ;; prepare this buffer for further processing | |
412 (setq buffer-read-only nil) | |
413 | |
414 ;; prevent accidental overwrite of the control file and autosave | |
415 (setq buffer-file-name nil) | |
416 (auto-save-mode nil) | |
417 | |
418 ;; and clean it | |
419 (erase-buffer))) | |
420 | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
421 ;; Make more local variables. |
276 | 422 (make-local-variable 'forms--file-buffer) |
423 (make-local-variable 'forms--total-records) | |
424 (make-local-variable 'forms--current-record) | |
425 (make-local-variable 'forms--the-record-list) | |
426 (make-local-variable 'forms--search-rexexp) | |
427 | |
428 ;; A bug in the current Emacs release prevents a keymap | |
429 ;; which is buffer-local from being used by 'describe-mode'. | |
430 ;; Hence we'll leave it global. | |
431 ;;(make-local-variable 'forms-mode-map) | |
432 (if forms-mode-map ; already defined | |
433 nil | |
434 (setq forms-mode-map (make-keymap)) | |
3827
4089cf0e3f06
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3697
diff
changeset
|
435 (forms--mode-commands forms-mode-map)) |
276 | 436 |
437 ;; find the data file | |
438 (setq forms--file-buffer (find-file-noselect forms-file)) | |
439 | |
440 ;; count the number of records, and set see if it may be modified | |
441 (let (ro) | |
442 (setq forms--total-records | |
443 (save-excursion | |
444 (set-buffer forms--file-buffer) | |
445 (bury-buffer (current-buffer)) | |
446 (setq ro buffer-read-only) | |
447 (count-lines (point-min) (point-max)))) | |
448 (if ro | |
449 (setq forms-read-only t))) | |
450 | |
451 ;; set the major mode indicator | |
452 (setq major-mode 'forms-mode) | |
453 (setq mode-name "Forms") | |
454 (make-local-variable 'minor-mode-alist) ; needed? | |
455 (forms--set-minor-mode) | |
456 (forms--set-keymaps) | |
3827
4089cf0e3f06
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3697
diff
changeset
|
457 (make-local-variable 'local-write-file-hooks) |
4089cf0e3f06
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3697
diff
changeset
|
458 (forms--change-commands) |
276 | 459 |
460 (set-buffer-modified-p nil) | |
461 | |
462 ;; We have our own revert function - use it | |
463 (make-local-variable 'revert-buffer-function) | |
464 (setq revert-buffer-function 'forms-revert-buffer) | |
465 | |
466 ;; setup the first (or current) record to show | |
467 (if (< forms--current-record 1) | |
468 (setq forms--current-record 1)) | |
469 (forms-jump-record forms--current-record) | |
470 | |
471 ;; user customising | |
472 (run-hooks 'forms-mode-hooks) | |
473 | |
474 ;; be helpful | |
475 (forms--help) | |
476 | |
477 ;; initialization done | |
478 (setq forms--mode-setup t)) | |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
479 |
276 | 480 ;;; forms-process-format-list |
481 ;;; | |
482 ;;; Validates forms-format-list. | |
483 ;;; Sets forms--number-of-markers and forms--markers. | |
484 | |
485 (defun forms--process-format-list () | |
486 "Validate forms-format-list and set some global variables." | |
487 | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
488 (forms--debug "forms-forms-list before 1st pass:\n" |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
489 'forms-format-list) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
490 |
276 | 491 ;; it must be non-nil |
492 (or forms-format-list | |
493 (error "'forms-format-list' has not been set")) | |
494 ;; it must be a list ... | |
495 (or (listp forms-format-list) | |
496 (error "'forms-format-list' is not a list")) | |
497 | |
498 (setq forms--number-of-markers 0) | |
499 | |
500 (let ((the-list forms-format-list) ; the list of format elements | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
501 (this-item 0) ; element in list |
276 | 502 (field-num 0)) ; highest field number |
503 | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
504 (setq forms-format-list nil) ; gonna rebuild |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
505 |
276 | 506 (while the-list |
507 | |
508 (let ((el (car-safe the-list)) | |
509 (rem (cdr-safe the-list))) | |
510 | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
511 ;; if it is a symbol, eval it first |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
512 (if (and (symbolp el) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
513 (boundp el)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
514 (setq el (eval el))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
515 |
276 | 516 (cond |
517 | |
518 ;; try string ... | |
519 ((stringp el)) ; string is OK | |
520 | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
521 ;; try numeric ... |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
522 ((numberp el) |
276 | 523 |
524 (if (or (<= el 0) | |
525 (> el forms-number-of-fields)) | |
526 (error | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
527 "Forms error: field number %d out of range 1..%d" |
276 | 528 el forms-number-of-fields)) |
529 | |
530 (setq forms--number-of-markers (1+ forms--number-of-markers)) | |
531 (if (> el field-num) | |
532 (setq field-num el))) | |
533 | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
534 ;; try function |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
535 ((listp el) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
536 (or (fboundp (car-safe el)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
537 (error |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
538 "Forms error: not a function: %s" |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
539 (prin1-to-string (car-safe el))))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
540 |
276 | 541 ;; else |
542 (t | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
543 (error "Invalid element in 'forms-format-list': %s" |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
544 (prin1-to-string el)))) |
276 | 545 |
546 ;; advance to next element of the list | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
547 (setq the-list rem) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
548 (setq forms-format-list |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
549 (append forms-format-list (list el) nil))))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
550 |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
551 (forms--debug "forms-forms-list after 1st pass:\n" |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
552 'forms-format-list) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
553 |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
554 ;; concat adjacent strings |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
555 (setq forms-format-list (forms--concat-adjacent forms-format-list)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
556 |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
557 (forms--debug "forms-forms-list after 2nd pass:\n" |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
558 'forms-format-list |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
559 'forms--number-of-markers) |
276 | 560 |
561 (setq forms--markers (make-vector forms--number-of-markers nil))) | |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
562 |
276 | 563 ;;; Build the format routine from forms-format-list. |
564 ;;; | |
565 ;;; The format routine (forms--format) will look like | |
566 ;;; | |
567 ;;; (lambda (arg) | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
568 ;;; (setq forms--dynamic-text nil) |
276 | 569 ;;; ;; "text: " |
570 ;;; (insert "text: ") | |
571 ;;; ;; 6 | |
572 ;;; (aset forms--markers 0 (point-marker)) | |
573 ;;; (insert (elt arg 5)) | |
574 ;;; ;; "\nmore text: " | |
575 ;;; (insert "\nmore text: ") | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
576 ;;; ;; (tocol 40) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
577 ;;; (let ((the-dyntext (tocol 40))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
578 ;;; (insert the-dyntext) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
579 ;;; (setq forms--dynamic-text (append forms--dynamic-text |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
580 ;;; (list the-dyntext)))) |
276 | 581 ;;; ;; 9 |
582 ;;; (aset forms--markers 1 (point-marker)) | |
583 ;;; (insert (elt arg 8)) | |
584 ;;; | |
585 ;;; ... ) | |
586 ;;; | |
587 | |
588 (defun forms--make-format () | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
589 "Generate format function for forms." |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
590 (setq forms--format (forms--format-maker forms-format-list)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
591 (forms--debug 'forms--format)) |
276 | 592 |
593 (defun forms--format-maker (the-format-list) | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
594 "Returns the parser function for forms." |
276 | 595 (let ((the-marker 0)) |
596 (` (lambda (arg) | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
597 (setq forms--dynamic-text nil) |
276 | 598 (,@ (apply 'append |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
599 (mapcar 'forms--make-format-elt the-format-list))))))) |
276 | 600 |
601 (defun forms--make-format-elt (el) | |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
602 (cond |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
603 ((stringp el) |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
604 (` ((insert (, el))))) |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
605 ((numberp el) |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
606 (prog1 |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
607 (` ((aset forms--markers (, the-marker) (point-marker)) |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
608 (insert (elt arg (, (1- el)))))) |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
609 (setq the-marker (1+ the-marker)))) |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
610 ((listp el) |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
611 (prog1 |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
612 (` ((let ((the-dyntext (, el))) |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
613 (insert the-dyntext) |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
614 (setq forms--dynamic-text (append forms--dynamic-text |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
615 (list the-dyntext))))) |
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
616 ))))) |
276 | 617 |
618 (defun forms--concat-adjacent (the-list) | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
619 "Concatenate adjacent strings in the-list and return the resulting list." |
276 | 620 (if (consp the-list) |
621 (let ((the-rest (forms--concat-adjacent (cdr the-list)))) | |
622 (if (and (stringp (car the-list)) (stringp (car the-rest))) | |
623 (cons (concat (car the-list) (car the-rest)) | |
624 (cdr the-rest)) | |
625 (cons (car the-list) the-rest))) | |
626 the-list)) | |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
627 |
276 | 628 ;;; forms--make-parser. |
629 ;;; | |
630 ;;; Generate parse routine from forms-format-list. | |
631 ;;; | |
632 ;;; The parse routine (forms--parser) will look like (give or take | |
633 ;;; a few " " . | |
634 ;;; | |
635 ;;; (lambda nil | |
636 ;;; (let (here) | |
637 ;;; (goto-char (point-min)) | |
638 ;;; | |
639 ;;; ;; "text: " | |
640 ;;; (if (not (looking-at "text: ")) | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
641 ;;; (error "Parse error: cannot find \"text: \"")) |
276 | 642 ;;; (forward-char 6) ; past "text: " |
643 ;;; | |
644 ;;; ;; 6 | |
645 ;;; ;; "\nmore text: " | |
646 ;;; (setq here (point)) | |
647 ;;; (if (not (search-forward "\nmore text: " nil t nil)) | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
648 ;;; (error "Parse error: cannot find \"\\nmore text: \"")) |
276 | 649 ;;; (aset the-recordv 5 (buffer-substring here (- (point) 12))) |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
650 ;;; |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
651 ;;; ;; (tocol 40) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
652 ;;; (let ((the-dyntext (car-safe forms--dynamic-text))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
653 ;;; (if (not (looking-at (regexp-quote the-dyntext))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
654 ;;; (error "Parse error: not looking at \"%s\"" the-dyntext)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
655 ;;; (forward-char (length the-dyntext)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
656 ;;; (setq forms--dynamic-text (cdr-safe forms--dynamic-text))) |
276 | 657 ;;; ... |
658 ;;; ;; final flush (due to terminator sentinel, see below) | |
659 ;;; (aset the-recordv 7 (buffer-substring (point) (point-max))) | |
660 ;;; | |
661 | |
662 (defun forms--make-parser () | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
663 "Generate parser function for forms." |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
664 (setq forms--parser (forms--parser-maker forms-format-list)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
665 (forms--debug 'forms--parser)) |
276 | 666 |
667 (defun forms--parser-maker (the-format-list) | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
668 "Returns the parser function for forms." |
276 | 669 (let ((the-field nil) |
670 (seen-text nil) | |
671 the--format-list) | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
672 ;; add a terminator sentinel |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
673 (setq the--format-list (append the-format-list (list nil))) |
276 | 674 (` (lambda nil |
675 (let (here) | |
676 (goto-char (point-min)) | |
677 (,@ (apply 'append | |
678 (mapcar 'forms--make-parser-elt the--format-list)))))))) | |
679 | |
680 (defun forms--make-parser-elt (el) | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
681 (cond |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
682 ((stringp el) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
683 (prog1 |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
684 (if the-field |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
685 (` ((setq here (point)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
686 (if (not (search-forward (, el) nil t nil)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
687 (error "Parse error: cannot find \"%s\"" (, el))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
688 (aset the-recordv (, (1- the-field)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
689 (buffer-substring here |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
690 (- (point) (, (length el))))))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
691 (` ((if (not (looking-at (, (regexp-quote el)))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
692 (error "Parse error: not looking at \"%s\"" (, el))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
693 (forward-char (, (length el)))))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
694 (setq seen-text t) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
695 (setq the-field nil))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
696 ((numberp el) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
697 (if the-field |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
698 (error "Cannot parse adjacent fields %d and %d" |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
699 the-field el) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
700 (setq the-field el) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
701 nil)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
702 ((null el) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
703 (if the-field |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
704 (` ((aset the-recordv (, (1- the-field)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
705 (buffer-substring (point) (point-max))))))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
706 ((listp el) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
707 (prog1 |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
708 (if the-field |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
709 (` ((let ((here (point)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
710 (the-dyntext (car-safe forms--dynamic-text))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
711 (if (not (search-forward the-dyntext nil t nil)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
712 (error "Parse error: cannot find \"%s\"" the-dyntext)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
713 (aset the-recordv (, (1- the-field)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
714 (buffer-substring here |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
715 (- (point) (length the-dyntext)))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
716 (setq forms--dynamic-text (cdr-safe forms--dynamic-text))))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
717 (` ((let ((the-dyntext (car-safe forms--dynamic-text))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
718 (if (not (looking-at (regexp-quote the-dyntext))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
719 (error "Parse error: not looking at \"%s\"" the-dyntext)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
720 (forward-char (length the-dyntext)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
721 (setq forms--dynamic-text (cdr-safe forms--dynamic-text)))))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
722 (setq seen-text t) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
723 (setq the-field nil))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
724 )) |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
725 |
276 | 726 (defun forms--set-minor-mode () |
727 (setq minor-mode-alist | |
728 (if forms-read-only | |
729 " View" | |
730 nil))) | |
731 | |
732 (defun forms--set-keymaps () | |
733 "Set the keymaps used in this mode." | |
734 | |
735 (if forms-read-only | |
736 (use-local-map forms-mode-map) | |
737 (use-local-map (make-sparse-keymap)) | |
738 (define-key (current-local-map) "\C-c" forms-mode-map) | |
739 (define-key (current-local-map) "\t" 'forms-next-field))) | |
740 | |
741 (defun forms--mode-commands (map) | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
742 "Fill map with all Forms mode commands." |
276 | 743 (define-key map "\t" 'forms-next-field) |
744 (define-key map " " 'forms-next-record) | |
745 (define-key map "d" 'forms-delete-record) | |
746 (define-key map "e" 'forms-edit-mode) | |
747 (define-key map "i" 'forms-insert-record) | |
748 (define-key map "j" 'forms-jump-record) | |
749 (define-key map "n" 'forms-next-record) | |
750 (define-key map "p" 'forms-prev-record) | |
751 (define-key map "q" 'forms-exit) | |
752 (define-key map "s" 'forms-search) | |
753 (define-key map "v" 'forms-view-mode) | |
754 (define-key map "x" 'forms-exit-no-save) | |
755 (define-key map "<" 'forms-first-record) | |
756 (define-key map ">" 'forms-last-record) | |
757 (define-key map "?" 'describe-mode) | |
758 (define-key map "\177" 'forms-prev-record) | |
759 ; (define-key map "\C-c" map) | |
760 (define-key map "\e" 'ESC-prefix) | |
761 (define-key map "\C-x" ctl-x-map) | |
762 (define-key map "\C-u" 'universal-argument) | |
763 (define-key map "\C-h" help-map) | |
764 ) | |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
765 |
276 | 766 ;;; Changed functions |
767 | |
768 (defun forms--change-commands () | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
769 "Localize some commands for Forms mode." |
276 | 770 ;; |
771 ;; scroll-down -> forms-prev-record | |
772 ;; scroll-up -> forms-next-record | |
3828 | 773 (if forms-forms-scroll |
774 (progn | |
775 (substitute-key-definition 'scroll-up 'forms-next-record | |
776 (current-local-map) | |
777 (current-global-map)) | |
778 (substitute-key-definition 'scroll-down 'forms-prev-record | |
779 (current-local-map) | |
780 (current-global-map)))) | |
276 | 781 ;; |
782 ;; beginning-of-buffer -> forms-first-record | |
783 ;; end-of-buffer -> forms-end-record | |
3828 | 784 (if forms-forms-jump |
785 (progn | |
786 (substitute-key-definition 'beginning-of-buffer 'forms-first-record | |
787 (current-local-map) | |
788 (current-global-map)) | |
789 (substitute-key-definition 'end-of-buffer 'forms-last-record | |
790 (current-local-map) | |
791 (current-global-map)))) | |
276 | 792 ;; |
793 ;; save-buffer -> forms--save-buffer | |
3828 | 794 (add-hook 'local-write-file-hooks |
795 (function | |
796 (lambda (nil) | |
797 (forms--checkmod) | |
798 (save-excursion | |
799 (set-buffer forms--file-buffer) | |
800 (save-buffer)) | |
801 t)))) | |
276 | 802 |
803 (defun forms--help () | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
804 "Initial help for Forms mode." |
276 | 805 ;; We should use |
806 ;;(message (substitute-command-keys (concat | |
807 ;;"\\[forms-next-record]:next" | |
808 ;;" \\[forms-prev-record]:prev" | |
809 ;;" \\[forms-first-record]:first" | |
810 ;;" \\[forms-last-record]:last" | |
811 ;;" \\[describe-mode]:help" | |
812 ;;" \\[forms-exit]:exit"))) | |
813 ;; but it's too slow .... | |
814 (if forms-read-only | |
815 (message "SPC:next DEL:prev <:first >:last ?:help q:exit") | |
816 (message "C-c n:next C-c p:prev C-c <:first C-c >:last C-c ?:help C-c q:exit"))) | |
817 | |
818 (defun forms--trans (subj arg rep) | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
819 "Translate in SUBJ all chars ARG into char REP. ARG and REP should |
276 | 820 be single-char strings." |
821 (let ((i 0) | |
822 (x (length subj)) | |
823 (re (regexp-quote arg)) | |
824 (k (string-to-char rep))) | |
825 (while (setq i (string-match re subj i)) | |
826 (aset subj i k) | |
827 (setq i (1+ i))))) | |
828 | |
829 (defun forms--exit (query &optional save) | |
830 (let ((buf (buffer-name forms--file-buffer))) | |
831 (forms--checkmod) | |
832 (if (and save | |
833 (buffer-modified-p forms--file-buffer)) | |
834 (save-excursion | |
835 (set-buffer forms--file-buffer) | |
836 (save-buffer))) | |
837 (save-excursion | |
838 (set-buffer forms--file-buffer) | |
839 (delete-auto-save-file-if-necessary) | |
840 (kill-buffer (current-buffer))) | |
841 (if (get-buffer buf) ; not killed??? | |
842 (if save | |
843 (progn | |
844 (beep) | |
845 (message "Problem saving buffers?"))) | |
846 (delete-auto-save-file-if-necessary) | |
847 (kill-buffer (current-buffer))))) | |
848 | |
849 (defun forms--get-record () | |
850 "Fetch the current record from the file buffer." | |
851 ;; | |
852 ;; This function is executed in the context of the forms--file-buffer. | |
853 ;; | |
854 (or (bolp) | |
855 (beginning-of-line nil)) | |
856 (let ((here (point))) | |
857 (prog2 | |
858 (end-of-line) | |
859 (buffer-substring here (point)) | |
860 (goto-char here)))) | |
861 | |
862 (defun forms--show-record (the-record) | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
863 "Format THE-RECORD and display it in the current buffer." |
276 | 864 |
865 ;; split the-record | |
866 (let (the-result | |
867 (start-pos 0) | |
868 found-pos | |
869 (field-sep-length (length forms-field-sep))) | |
870 (if forms-multi-line | |
871 (forms--trans the-record forms-multi-line "\n")) | |
872 ;; add an extra separator (makes splitting easy) | |
873 (setq the-record (concat the-record forms-field-sep)) | |
874 (while (setq found-pos (string-match forms-field-sep the-record start-pos)) | |
875 (let ((ent (substring the-record start-pos found-pos))) | |
876 (setq the-result | |
877 (append the-result (list ent))) | |
878 (setq start-pos (+ field-sep-length found-pos)))) | |
879 (setq forms--the-record-list the-result)) | |
880 | |
881 (setq buffer-read-only nil) | |
882 (erase-buffer) | |
883 | |
884 ;; verify the number of fields, extend forms--the-record-list if needed | |
885 (if (= (length forms--the-record-list) forms-number-of-fields) | |
886 nil | |
887 (beep) | |
888 (message "Record has %d fields instead of %d." | |
889 (length forms--the-record-list) forms-number-of-fields) | |
890 (if (< (length forms--the-record-list) forms-number-of-fields) | |
891 (setq forms--the-record-list | |
892 (append forms--the-record-list | |
893 (make-list | |
894 (- forms-number-of-fields | |
895 (length forms--the-record-list)) | |
896 ""))))) | |
897 | |
898 ;; call the formatter function | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
899 (setq forms-fields (append (list nil) forms--the-record-list nil)) |
276 | 900 (funcall forms--format forms--the-record-list) |
901 | |
902 ;; prepare | |
903 (goto-char (point-min)) | |
904 (set-buffer-modified-p nil) | |
905 (setq buffer-read-only forms-read-only) | |
906 (setq mode-line-process | |
907 (concat " " forms--current-record "/" forms--total-records))) | |
908 | |
909 (defun forms--parse-form () | |
910 "Parse contents of form into list of strings." | |
911 ;; The contents of the form are parsed, and a new list of strings | |
912 ;; is constructed. | |
913 ;; A vector with the strings from the original record is | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
914 ;; constructed, which is updated with the new contents. Therefore |
276 | 915 ;; fields which were not in the form are not modified. |
916 ;; Finally, the vector is transformed into a list for further processing. | |
917 | |
918 (let (the-recordv) | |
919 | |
920 ;; build the vector | |
921 (setq the-recordv (vconcat forms--the-record-list)) | |
922 | |
923 ;; parse the form and update the vector | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
924 (let ((forms--dynamic-text forms--dynamic-text)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
925 (funcall forms--parser)) |
276 | 926 |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
927 (if forms--modified-record-filter |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
928 ;; As a service to the user, we add a zeroth element so she |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
929 ;; can use the same indices as in the forms definition. |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
930 (let ((the-fields (vconcat [nil] the-recordv))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
931 (setq the-fields (funcall forms--modified-record-filter the-fields)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
932 (cdr (append the-fields nil))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
933 |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
934 ;; transform to a list and return |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
935 (append the-recordv nil)))) |
276 | 936 |
937 (defun forms--update () | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
938 "Update current record with contents of form. |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
939 As a side effect: sets forms--the-record-list ." |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
940 |
276 | 941 (if forms-read-only |
942 (progn | |
943 (message "Read-only buffer!") | |
944 (beep)) | |
945 | |
946 (let (the-record) | |
947 ;; build new record | |
948 (setq forms--the-record-list (forms--parse-form)) | |
949 (setq the-record | |
950 (mapconcat 'identity forms--the-record-list forms-field-sep)) | |
951 | |
952 ;; handle multi-line fields, if allowed | |
953 (if forms-multi-line | |
954 (forms--trans the-record "\n" forms-multi-line)) | |
955 | |
956 ;; a final sanity check before updating | |
957 (if (string-match "\n" the-record) | |
958 (progn | |
959 (message "Multi-line fields in this record - update refused!") | |
960 (beep)) | |
961 | |
962 (save-excursion | |
963 (set-buffer forms--file-buffer) | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
964 ;; Insert something before kill-line is called. See kill-line |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
965 ;; doc. Bugfix provided by Ignatios Souvatzis. |
276 | 966 (insert "*") |
967 (beginning-of-line) | |
968 (kill-line nil) | |
969 (insert the-record) | |
970 (beginning-of-line)))))) | |
971 | |
972 (defun forms--checkmod () | |
973 "Check if this form has been modified, and call forms--update if so." | |
974 (if (buffer-modified-p nil) | |
975 (let ((here (point))) | |
976 (forms--update) | |
977 (set-buffer-modified-p nil) | |
978 (goto-char here)))) | |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
979 |
276 | 980 ;;; Start and exit |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
981 |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
982 ;;;###autoload |
276 | 983 (defun forms-find-file (fn) |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
984 "Visit a file in Forms mode." |
276 | 985 (interactive "fForms file: ") |
986 (find-file-read-only fn) | |
987 (or forms--mode-setup (forms-mode t))) | |
988 | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
989 ;;;###autoload |
276 | 990 (defun forms-find-file-other-window (fn) |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
991 "Visit a file in Forms mode in other window." |
276 | 992 (interactive "fFbrowse file in other window: ") |
993 (find-file-other-window fn) | |
994 (eval-current-buffer) | |
995 (or forms--mode-setup (forms-mode t))) | |
996 | |
997 (defun forms-exit (query) | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
998 "Normal exit from Forms mode. Modified buffers are saved." |
276 | 999 (interactive "P") |
1000 (forms--exit query t)) | |
1001 | |
1002 (defun forms-exit-no-save (query) | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1003 "Exit from Forms mode without saving buffers." |
276 | 1004 (interactive "P") |
1005 (forms--exit query nil)) | |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
1006 |
276 | 1007 ;;; Navigating commands |
1008 | |
1009 (defun forms-next-record (arg) | |
1010 "Advance to the ARGth following record." | |
1011 (interactive "P") | |
1012 (forms-jump-record (+ forms--current-record (prefix-numeric-value arg)) t)) | |
1013 | |
1014 (defun forms-prev-record (arg) | |
1015 "Advance to the ARGth previous record." | |
1016 (interactive "P") | |
1017 (forms-jump-record (- forms--current-record (prefix-numeric-value arg)) t)) | |
1018 | |
1019 (defun forms-jump-record (arg &optional relative) | |
1020 "Jump to a random record." | |
1021 (interactive "NRecord number: ") | |
1022 | |
1023 ;; verify that the record number is within range | |
1024 (if (or (> arg forms--total-records) | |
1025 (<= arg 0)) | |
1026 (progn | |
1027 (beep) | |
1028 ;; don't give the message if just paging | |
1029 (if (not relative) | |
1030 (message "Record number %d out of range 1..%d" | |
1031 arg forms--total-records)) | |
1032 ) | |
1033 | |
1034 ;; flush | |
1035 (forms--checkmod) | |
1036 | |
1037 ;; calculate displacement | |
1038 (let ((disp (- arg forms--current-record)) | |
1039 (cur forms--current-record)) | |
1040 | |
1041 ;; forms--show-record needs it now | |
1042 (setq forms--current-record arg) | |
1043 | |
1044 ;; get the record and show it | |
1045 (forms--show-record | |
1046 (save-excursion | |
1047 (set-buffer forms--file-buffer) | |
1048 (beginning-of-line) | |
1049 | |
1050 ;; move, and adjust the amount if needed (shouldn't happen) | |
1051 (if relative | |
1052 (if (zerop disp) | |
1053 nil | |
1054 (setq cur (+ cur disp (- (forward-line disp))))) | |
1055 (setq cur (+ cur disp (- (goto-line arg))))) | |
1056 | |
1057 (forms--get-record))) | |
1058 | |
1059 ;; this shouldn't happen | |
1060 (if (/= forms--current-record cur) | |
1061 (progn | |
1062 (setq forms--current-record cur) | |
1063 (beep) | |
1064 (message "Stuck at record %d." cur)))))) | |
1065 | |
1066 (defun forms-first-record () | |
1067 "Jump to first record." | |
1068 (interactive) | |
1069 (forms-jump-record 1)) | |
1070 | |
1071 (defun forms-last-record () | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1072 "Jump to last record. |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1073 As a side effect: re-calculates the number of records in the data file." |
276 | 1074 (interactive) |
1075 (let | |
1076 ((numrec | |
1077 (save-excursion | |
1078 (set-buffer forms--file-buffer) | |
1079 (count-lines (point-min) (point-max))))) | |
1080 (if (= numrec forms--total-records) | |
1081 nil | |
1082 (beep) | |
1083 (setq forms--total-records numrec) | |
1084 (message "Number of records reset to %d." forms--total-records))) | |
1085 (forms-jump-record forms--total-records)) | |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
1086 |
276 | 1087 ;;; Other commands |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1088 |
276 | 1089 (defun forms-view-mode () |
1090 "Visit buffer read-only." | |
1091 (interactive) | |
1092 (if forms-read-only | |
1093 nil | |
1094 (forms--checkmod) ; sync | |
1095 (setq forms-read-only t) | |
1096 (forms-mode))) | |
1097 | |
1098 (defun forms-edit-mode () | |
1099 "Make form suitable for editing, if possible." | |
1100 (interactive) | |
1101 (let ((ro forms-read-only)) | |
1102 (if (save-excursion | |
1103 (set-buffer forms--file-buffer) | |
1104 buffer-read-only) | |
1105 (progn | |
1106 (setq forms-read-only t) | |
1107 (message "No write access to \"%s\"" forms-file) | |
1108 (beep)) | |
1109 (setq forms-read-only nil)) | |
1110 (if (equal ro forms-read-only) | |
1111 nil | |
1112 (forms-mode)))) | |
1113 | |
1114 ;; Sample: | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1115 ;; (defun my-new-record-filter (the-fields) |
276 | 1116 ;; ;; numbers are relative to 1 |
1117 ;; (aset the-fields 4 (current-time-string)) | |
1118 ;; (aset the-fields 6 (user-login-name)) | |
1119 ;; the-list) | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1120 ;; (setq forms-new-record-filter 'my-new-record-filter) |
276 | 1121 |
1122 (defun forms-insert-record (arg) | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1123 "Create a new record before the current one. |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1124 With ARG: store the record after the current one. |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1125 If a function forms-new-record-filter is defined, or |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1126 forms-new-record-filter contains the name of a function, |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1127 it is called to fill (some of) the fields with default values." |
276 | 1128 ; The above doc is not true, but for documentary purposes only |
1129 | |
1130 (interactive "P") | |
1131 | |
1132 (let ((ln (if arg (1+ forms--current-record) forms--current-record)) | |
1133 the-list the-record) | |
1134 | |
1135 (forms--checkmod) | |
1136 (if forms--new-record-filter | |
1137 ;; As a service to the user, we add a zeroth element so she | |
1138 ;; can use the same indices as in the forms definition. | |
1139 (let ((the-fields (make-vector (1+ forms-number-of-fields) ""))) | |
1140 (setq the-fields (funcall forms--new-record-filter the-fields)) | |
1141 (setq the-list (cdr (append the-fields nil)))) | |
1142 (setq the-list (make-list forms-number-of-fields ""))) | |
1143 | |
1144 (setq the-record | |
1145 (mapconcat | |
1146 'identity | |
1147 the-list | |
1148 forms-field-sep)) | |
1149 | |
1150 (save-excursion | |
1151 (set-buffer forms--file-buffer) | |
1152 (goto-line ln) | |
1153 (open-line 1) | |
1154 (insert the-record) | |
1155 (beginning-of-line)) | |
1156 | |
1157 (setq forms--current-record ln)) | |
1158 | |
1159 (setq forms--total-records (1+ forms--total-records)) | |
1160 (forms-jump-record forms--current-record)) | |
1161 | |
1162 (defun forms-delete-record (arg) | |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1163 "Deletes a record. With a prefix argument: don't ask." |
276 | 1164 (interactive "P") |
1165 (forms--checkmod) | |
1166 (if (or arg | |
1167 (y-or-n-p "Really delete this record? ")) | |
1168 (let ((ln forms--current-record)) | |
1169 (save-excursion | |
1170 (set-buffer forms--file-buffer) | |
1171 (goto-line ln) | |
1172 (kill-line 1)) | |
1173 (setq forms--total-records (1- forms--total-records)) | |
1174 (if (> forms--current-record forms--total-records) | |
1175 (setq forms--current-record forms--total-records)) | |
1176 (forms-jump-record forms--current-record))) | |
1177 (message "")) | |
1178 | |
1179 (defun forms-search (regexp) | |
1180 "Search REGEXP in file buffer." | |
1181 (interactive | |
1182 (list (read-string (concat "Search for" | |
1183 (if forms--search-regexp | |
1184 (concat " (" | |
1185 forms--search-regexp | |
1186 ")")) | |
1187 ": ")))) | |
1188 (if (equal "" regexp) | |
1189 (setq regexp forms--search-regexp)) | |
1190 (forms--checkmod) | |
1191 | |
1192 (let (the-line the-record here | |
1193 (fld-sep forms-field-sep)) | |
1194 (if (save-excursion | |
1195 (set-buffer forms--file-buffer) | |
1196 (setq here (point)) | |
1197 (end-of-line) | |
1198 (if (null (re-search-forward regexp nil t)) | |
1199 (progn | |
1200 (goto-char here) | |
1201 (message (concat "\"" regexp "\" not found.")) | |
1202 nil) | |
1203 (setq the-record (forms--get-record)) | |
1204 (setq the-line (1+ (count-lines (point-min) (point)))))) | |
1205 (progn | |
1206 (setq forms--current-record the-line) | |
1207 (forms--show-record the-record) | |
1208 (re-search-forward regexp nil t)))) | |
1209 (setq forms--search-regexp regexp)) | |
1210 | |
1211 (defun forms-revert-buffer (&optional arg noconfirm) | |
1212 "Reverts current form to un-modified." | |
1213 (interactive "P") | |
1214 (if (or noconfirm | |
1215 (yes-or-no-p "Revert form to unmodified? ")) | |
1216 (progn | |
1217 (set-buffer-modified-p nil) | |
1218 (forms-jump-record forms--current-record)))) | |
1219 | |
1220 (defun forms-next-field (arg) | |
1221 "Jump to ARG-th next field." | |
1222 (interactive "p") | |
1223 | |
1224 (let ((i 0) | |
1225 (here (point)) | |
1226 there | |
1227 (cnt 0)) | |
1228 | |
1229 (if (zerop arg) | |
1230 (setq cnt 1) | |
1231 (setq cnt (+ cnt arg))) | |
1232 | |
1233 (if (catch 'done | |
1234 (while (< i forms--number-of-markers) | |
1235 (if (or (null (setq there (aref forms--markers i))) | |
1236 (<= there here)) | |
1237 nil | |
1238 (if (<= (setq cnt (1- cnt)) 0) | |
1239 (progn | |
1240 (goto-char there) | |
1241 (throw 'done t)))) | |
1242 (setq i (1+ i)))) | |
1243 nil | |
1244 (goto-char (aref forms--markers 0))))) | |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1245 |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1246 ;;; |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1247 ;;; Special service |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1248 ;;; |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1249 (defun forms-enumerate (the-fields) |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1250 "Take a quoted list of symbols, and set their values to sequential numbers. |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1251 The first symbol gets number 1, the second 2 and so on. |
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1252 It returns the higest number. |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1253 |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1254 Usage: (setq forms-number-of-fields |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1255 (forms-enumerate |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1256 '(field1 field2 field2 ...)))" |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1257 |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1258 (let ((the-index 0)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1259 (while the-fields |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1260 (setq the-index (1+ the-index)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1261 (let ((el (car-safe the-fields))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1262 (setq the-fields (cdr-safe the-fields)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1263 (set el the-index))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1264 the-index)) |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
1265 |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1266 ;;; Debugging |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1267 |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1268 (defvar forms--debug nil |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1269 "*Enables forms-mode debugging if not nil.") |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1270 |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1271 (defun forms--debug (&rest args) |
3941
93a7a7b97030
Add e-mail address and version info.
Richard M. Stallman <rms@gnu.org>
parents:
3828
diff
changeset
|
1272 "Internal debugging routine." |
307
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1273 (if forms--debug |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1274 (let ((ret nil)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1275 (while args |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1276 (let ((el (car-safe args))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1277 (setq args (cdr-safe args)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1278 (if (stringp el) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1279 (setq ret (concat ret el)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1280 (setq ret (concat ret (prin1-to-string el) " = ")) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1281 (if (boundp el) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1282 (let ((vel (eval el))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1283 (setq ret (concat ret (prin1-to-string vel) "\n"))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1284 (setq ret (concat ret "<unbound>" "\n"))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1285 (if (fboundp el) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1286 (setq ret (concat ret (prin1-to-string (symbol-function el)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1287 "\n")))))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1288 (save-excursion |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1289 (set-buffer (get-buffer-create "*forms-mode debug*")) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1290 (goto-char (point-max)) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1291 (insert ret))))) |
7fede845e304
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
276
diff
changeset
|
1292 |
3697
994bb6dc9249
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
307
diff
changeset
|
1293 ;;; forms.el ends here. |