home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3374 < prev    next >
Internet Message Format  |  1991-05-20  |  26KB

  1. From: jv@mh.nl (Johan Vromans)
  2. Newsgroups: gnu.emacs.sources,alt.sources
  3. Subject: GNU Emacs forms-mode version 1.2.2, part 1 of 3
  4. Message-ID: <1991May20.093009.1437@pronto.mh.nl>
  5. Date: 20 May 91 09:30:09 GMT
  6.  
  7.  
  8. This is GNU Emacs 'forms-mode', version 1.2 (patchlevel 2).
  9.  
  10. This GNU Emacs major mode implements editing a structured file (i.e. a
  11. file with 'records' and 'fields' in it) using a forms. 
  12. It is fully documented in the source file 'forms.el' and in the
  13. texinfo file 'forms.ti'.
  14.  
  15. Changes in forms-mode 1.2.1 to 1.2.2:
  16.  
  17.  * Correct a bug that prevented the modifications to the last field of a
  18.    form to be handled correctly if that field is the last thing on the
  19.    form. 
  20.  
  21. Submitted-by: jv@mh.nl
  22. Archive-name: forms/part01
  23.  
  24. ---- Cut Here and feed the following to sh ----
  25. #!/bin/sh
  26. # This is forms, a shell archive (produced by shar 3.49)
  27. # To extract the files from this archive, save it to a file, remove
  28. # everything above the "!/bin/sh" line above, and type "sh file_name".
  29. #
  30. # made 05/20/1991 09:16 UTC by jv@mh.nl
  31. # Source directory /u1/users/jv/elisp/src/forms-mode/Work
  32. #
  33. # existing files will NOT be overwritten unless -c is specified
  34. #
  35. # This is part 1 of a multipart archive                                    
  36. # do not concatenate these parts, unpack them in order with /bin/sh        
  37. #
  38. # This shar contains:
  39. # length  mode       name
  40. # ------ ---------- ------------------------------------------
  41. #   2545 -rw-r--r-- README
  42. #     47 -rw-r--r-- MANIFEST
  43. #    436 -rw-r--r-- demo1
  44. #    475 -rw-r--r-- demo2
  45. #    476 -rw-r--r-- demo2.dat
  46. #  21930 -r--r--r-- forms.ti
  47. #  36048 -r--r--r-- forms.el
  48. #
  49. if test -r _shar_seq_.tmp; then
  50.     echo 'Must unpack archives in sequence!'
  51.     echo Please unpack part `cat _shar_seq_.tmp` next
  52.     exit 1
  53. fi
  54. # ============= README ==============
  55. if test -f 'README' -a X"$1" != X"-c"; then
  56.     echo 'x - skipping README (File already exists)'
  57.     rm -f _shar_wnt_.tmp
  58. else
  59. > _shar_wnt_.tmp
  60. echo 'x - extracting README (Text)'
  61. sed 's/^X//' << 'SHAR_EOF' > 'README' &&
  62. This is GNU Emacs 'forms-mode', version 1.2 (patchlevel 2).
  63. X
  64. This GNU Emacs major mode implements editing a structured file (i.e. a
  65. file with 'records' and 'fields' in it) using a forms. 
  66. It is fully documented in the source file 'forms.el' and in the
  67. texinfo file 'forms.ti'.
  68. X
  69. This kit contains:
  70. X
  71. X    README        - this file
  72. X    MANIFEST    - list of files
  73. X    forms.el    - the lisp source
  74. X    forms.ti    - texinfo file
  75. X    demo1        - demo using /etc/passwd
  76. X    demo2        - demo using 'demo2.dat'
  77. X    demo2.dat    - data for demo2
  78. X
  79. Load the lisp source, and execute
  80. X
  81. X    forms-find-file demo1
  82. X
  83. to look at your password file in a unconventional (but read-only) way.
  84. X
  85. X    forms-find-file demo2
  86. X
  87. gives you something to clobber with data and multi-line fields.
  88. X
  89. This program has been donated to the Free Software Foundation to be
  90. part of their GNU Emacs programming system.
  91. X
  92. Have fun!
  93. X
  94. X    Johan Vromans    <jv@mh.nl>
  95. X
  96. HISTORY
  97. -------
  98. X
  99. 1.2.2  Released: May 20, 1991
  100. X
  101. X Fixed bug:
  102. X  * The modifications to the last field of a form were not handled
  103. X    correctly if that field was not followed by fixed text.
  104. X
  105. 1.2.1  Released: Sep 18, 1990
  106. X
  107. X New feature:
  108. X  * Is it now possible to define a function `forms-new-record-filter' in
  109. X    the control file, that gets called when a new record is created.
  110. X    It can be used to insert default values in fields.
  111. X    Thanks to Harald Hanche-Olsen <hanche@imf.unit.no> .
  112. X
  113. X Fixed bugs:
  114. X  * `save-buffer' was redefined as (interactive "P"). This should have
  115. X    been (interactive "p").
  116. X    Thanks to Jonathan Kamens <jik@pit-manager.MIT.EDU> .
  117. X  * `forms--checkmod' was not called often enough to prevent modified
  118. X    records from getting lost in spurious situations.
  119. X    Thanks to u502sou@mpirbn.uucp (Ignatios Souvatzis).
  120. X  * When updating a new record, sometimes it got prepended to the next
  121. X    record. 
  122. X    Thanks to several users.
  123. X
  124. X Other modifications:
  125. X  * Harald Hanche-Olsen <hanche@imf.unit.no> rewrote
  126. X    forms--make-format and forms--make-parser to use the more standard
  127. X    backquote construct.
  128. X
  129. X And finally:
  130. X  * Ignatios Souvatzis wrote a forms routine to sort a file on
  131. X    selected fields. I did not include it because I don't think that
  132. X    sorting belongs to the functionality of forms-mode. Ignatios
  133. X    wrote me:
  134. X
  135. X      as i didn't want to look up the man page for /bin/sort, i wrote
  136. X      a sort function for you forms mode. You may include it in your
  137. X      next distribution to the net or FSF, if you want (as long as
  138. X      there remains a trace of who wrote that ~30 lines). Else tell me
  139. X      please so that i can post the sort code myself.
  140. SHAR_EOF
  141. chmod 0644 README ||
  142. echo 'restore of README failed'
  143. Wc_c="`wc -c < 'README'`"
  144. test 2545 -eq "$Wc_c" ||
  145.     echo 'README: original size 2545, current size' "$Wc_c"
  146. rm -f _shar_wnt_.tmp
  147. fi
  148. # ============= MANIFEST ==============
  149. if test -f 'MANIFEST' -a X"$1" != X"-c"; then
  150.     echo 'x - skipping MANIFEST (File already exists)'
  151.     rm -f _shar_wnt_.tmp
  152. else
  153. > _shar_wnt_.tmp
  154. echo 'x - extracting MANIFEST (Text)'
  155. sed 's/^X//' << 'SHAR_EOF' > 'MANIFEST' &&
  156. README
  157. forms.el
  158. forms.ti
  159. demo1
  160. demo2
  161. demo2.dat
  162. SHAR_EOF
  163. chmod 0644 MANIFEST ||
  164. echo 'restore of MANIFEST failed'
  165. Wc_c="`wc -c < 'MANIFEST'`"
  166. test 47 -eq "$Wc_c" ||
  167.     echo 'MANIFEST: original size 47, current size' "$Wc_c"
  168. rm -f _shar_wnt_.tmp
  169. fi
  170. # ============= demo1 ==============
  171. if test -f 'demo1' -a X"$1" != X"-c"; then
  172.     echo 'x - skipping demo1 (File already exists)'
  173.     rm -f _shar_wnt_.tmp
  174. else
  175. > _shar_wnt_.tmp
  176. echo 'x - extracting demo1 (Text)'
  177. sed 's/^X//' << 'SHAR_EOF' > 'demo1' &&
  178. ;; demo for forms-mode
  179. ;;
  180. ;; This demo visits /etc/passwd.
  181. X
  182. (setq forms-file "/etc/passwd")
  183. (setq forms-read-only t)        ; to make sure
  184. (setq forms-field-sep ":")
  185. (setq forms-number-of-fields 7)
  186. (setq forms-format-list
  187. X     '("====== Visiting /etc/passwd ======\n\n"
  188. X       "User : "    1
  189. X       "   Uid: "    3
  190. X       "   Gid: "    4
  191. X       "\n\n"
  192. X       "Name : "    5
  193. X       "\n\n"
  194. X       "Home : "    6
  195. X       "\n\n"
  196. X       "Shell: "    7
  197. X       "\n"))
  198. SHAR_EOF
  199. chmod 0644 demo1 ||
  200. echo 'restore of demo1 failed'
  201. Wc_c="`wc -c < 'demo1'`"
  202. test 436 -eq "$Wc_c" ||
  203.     echo 'demo1: original size 436, current size' "$Wc_c"
  204. rm -f _shar_wnt_.tmp
  205. fi
  206. # ============= demo2 ==============
  207. if test -f 'demo2' -a X"$1" != X"-c"; then
  208.     echo 'x - skipping demo2 (File already exists)'
  209.     rm -f _shar_wnt_.tmp
  210. else
  211. > _shar_wnt_.tmp
  212. echo 'x - extracting demo2 (Text)'
  213. sed 's/^X//' << 'SHAR_EOF' > 'demo2' &&
  214. ;; test forms-mode    -*- emacs-lisp -*-
  215. ;;
  216. (setq forms-file "demo2.dat")
  217. (setq forms-number-of-fields 11)
  218. (setq forms-format-list
  219. X     '(
  220. X       "====== Public Domain Software Archive ======\n\n"    5
  221. X       " - "            8
  222. X       "\n\n"
  223. X       "Article: "        1
  224. X       "/"            4
  225. X       "    Issue: "        3
  226. X       "    Date: "        10
  227. X       "\n\n"
  228. X       "Submitted by: "        7
  229. X       "\n\n"
  230. X       "Keywords: "        9
  231. X       "\n\n"
  232. X       "Parts: "        6
  233. X       "\n\n====== Remarks ======\n\n"        11
  234. X     ))
  235. SHAR_EOF
  236. chmod 0644 demo2 ||
  237. echo 'restore of demo2 failed'
  238. Wc_c="`wc -c < 'demo2'`"
  239. test 475 -eq "$Wc_c" ||
  240.     echo 'demo2: original size 475, current size' "$Wc_c"
  241. rm -f _shar_wnt_.tmp
  242. fi
  243. # ============= demo2.dat ==============
  244. if test -f 'demo2.dat' -a X"$1" != X"-c"; then
  245.     echo 'x - skipping demo2.dat (File already exists)'
  246.     rm -f _shar_wnt_.tmp
  247. else
  248. > _shar_wnt_.tmp
  249. echo 'x - extracting demo2.dat (Text)'
  250. sed 's/^X//' << 'SHAR_EOF' > 'demo2.dat' &&
  251. comp.sources.unix        v11i008    269    getty-enable    1    tron@sc.nsc.com (Ronald S. Karr)    Getty on/off programs for 4.[23] BSD        890505    
  252. comp.sources.unix    11    v11i022    283    syslog    1    emory!arnold (Arnold D. Robbins {EUCC})    Development version of syslog(3), for ATT, too        28/08/1987    
  253. comp.sources.unix    11    v11i033    290    less3    3    sun!intsc!convgt!mark    The 'less' pager        02/09/1987    
  254. comp.sources.unix    11    v11i036    293    test.el    3    "Mark A. Ardis" <maa@sei.cmu.edu>    Test system for GNU Emacs        10/09/1987    
  255. SHAR_EOF
  256. chmod 0644 demo2.dat ||
  257. echo 'restore of demo2.dat failed'
  258. Wc_c="`wc -c < 'demo2.dat'`"
  259. test 476 -eq "$Wc_c" ||
  260.     echo 'demo2.dat: original size 476, current size' "$Wc_c"
  261. rm -f _shar_wnt_.tmp
  262. fi
  263. # ============= forms.ti ==============
  264. if test -f 'forms.ti' -a X"$1" != X"-c"; then
  265.     echo 'x - skipping forms.ti (File already exists)'
  266.     rm -f _shar_wnt_.tmp
  267. else
  268. > _shar_wnt_.tmp
  269. echo 'x - extracting forms.ti (Text)'
  270. sed 's/^X//' << 'SHAR_EOF' > 'forms.ti' &&
  271. \input texinfo            @c -*-texinfo-*- @(#)@ forms 1.2.2
  272. @comment %**start of header (This is for running Texinfo on a region.)
  273. @setfilename forms.info
  274. @settitle Forms Mode User's Manual
  275. @iftex
  276. @finalout
  277. @setchapternewpage odd
  278. @end iftex
  279. @c      @smallbook
  280. @comment %**end of header (This is for running Texinfo on a region.)
  281. X
  282. @tex
  283. \global\chapno=30
  284. @end tex
  285. X
  286. @ifinfo
  287. This file documents forms-mode, a forms based major mode for GNU Emacs.
  288. X
  289. Permission is granted to make and distribute verbatim copies of this
  290. manual provided the copyright notice and this permission notice are
  291. preserved on all copies.
  292. X
  293. @ignore
  294. Permission is granted to process this file through TeX and print the
  295. results, provided the printed document carries copying permission notice
  296. identical to this one except for the removal of this paragraph (this
  297. paragraph not being relevant to the printed manual).
  298. X
  299. @end ignore
  300. @end ifinfo
  301. X
  302. @iftex
  303. @titlepage
  304. @sp 6
  305. @center @titlefont{Forms Mode User's Manual}
  306. @sp 4
  307. @center Forms-Mode version 1.2, patchlevel 2
  308. @sp 1
  309. @center May 1991
  310. @sp 5
  311. @center Johan Vromans
  312. @center @i{jv@@mh.nl}
  313. @page
  314. X
  315. @vskip 0pt plus 1filll
  316. Copyright @copyright{} 1989,1990,1991 Free Software Foundation, Inc.
  317. X
  318. Permission is granted to make and distribute verbatim copies of
  319. this manual provided the copyright notice and this permission notice
  320. are preserved on all copies.
  321. X
  322. @end titlepage
  323. @page
  324. @end iftex
  325. X
  326. @ifinfo
  327. @node Top, What is in a Forms, , (DIR)
  328. @end ifinfo
  329. X
  330. @iftex
  331. @chapter Forms mode
  332. @end iftex
  333. X
  334. Forms mode is an Emacs major mode for working with simple plain-text
  335. databases in a forms-oriented manner. In forms mode, the information in
  336. these files is presented in an Emacs window in a user-defined format,
  337. one record at a time. Forms can be inspected read-only (viewing) or
  338. modified and updated.
  339. @cindex forms-mode
  340. X
  341. Forms mode is not a simple major mode, but requires two files to do its
  342. job: a control file and a data file. The data file holds the
  343. actual data which will be presented. The control file describes
  344. how it will be presented.
  345. X
  346. @menu
  347. * What is in a Forms::    Introduction.
  348. * Data File Format::    How to format the data file.
  349. * Control File Format::    How to control forms mode.
  350. * Forms Format Description::
  351. X            How to define the forms layout.
  352. * Modifying Forms Contents::
  353. X            How to modify.
  354. * Forms Mode Commands::    The commands available, and how to use them.
  355. * Key Bindings::    Which keys are bound to what commands.
  356. * Miscellaneous::    Forms mode messages and other remarks.
  357. * Credits::        Thanks everyone.
  358. * Concept Index::    Index of Concepts
  359. * Variable Index::    Index of Variables.
  360. * Function Index::    Index of Functions.
  361. @end menu
  362. X
  363. @node What is in a Forms, Data File Format, Top, Top
  364. @section What is in a forms
  365. X
  366. Let's illustrate forms mode with an example. Suppose you are looking at
  367. your @file{/etc/passwd} file, and your screen looks as follows:
  368. X
  369. @example
  370. ====== /etc/passwd ======
  371. X
  372. User : root   Uid: 0   Gid: 1
  373. X
  374. Name : Super User
  375. X
  376. Home : /
  377. X
  378. Shell: /bin/sh
  379. @end example
  380. X
  381. As you can see, the familiar fields from the entry for the super user
  382. are all there, but instead of one single line, they make up a forms.
  383. X
  384. The contents of the forms consists of the contents of the fields of the
  385. record (e.g. @code{root}, @code{0}, @code{1}, @code{Super User})
  386. interspersed with normal text (e.g @code{User : }, @code{Uid: }).
  387. X
  388. You can define yourself how text and fields will be used to make up the
  389. forms.
  390. X
  391. When you modifiy the contents of the forms, it will be analyzed and the
  392. new contents of the fields of this record will be extracted. It
  393. possible, the file will be updated with the new contents.
  394. X
  395. @node Data File Format, Control File Format, What is in a Forms, Top
  396. @section Data file format
  397. X
  398. Files for use with forms mode are very simple -- each record forms the
  399. contents one form.  Each record is supposed to consist of a number of
  400. fields. These fields are separated by the value of the string
  401. @code{forms-field-sep}, which is a @code{TAB} by default.
  402. X
  403. @cindex pseudo-newline
  404. Fields may contain text which shows up in the forms in multiple lines.
  405. These lines are separated in the field using a @var{pseudo-newline}
  406. character which is defined by the value of the string
  407. @code{forms-multi-line}. Its default value is a Control-K character. If
  408. it is set to @code{nil} multiple line fields are prohibited.
  409. X
  410. @node Control File Format, Forms Format Description, Data File Format, Top
  411. @section Control file format
  412. X
  413. The control file serves two purposes.
  414. X
  415. First, it defines the data file to use, and its properties.
  416. X
  417. Second, the Emacs buffer it occupies will be used by the forms mode to
  418. display the forms.
  419. X
  420. @findex eval-current-buffer
  421. The contents of the control file are evaluated using the Emacs command
  422. @code{eval-current-buffer}, hence must contain valid Emacs-lisp expressions.
  423. These expressions should set the following lisp variables to a suitable
  424. value:
  425. X
  426. @table @code
  427. @vindex forms-file
  428. @item forms-file
  429. This variable must be set to the name of the data file.@*
  430. Example:
  431. @example
  432. (setq forms-file "my/data-file")
  433. @end example
  434. X
  435. @item forms-format-list
  436. This variable describes the way the fields of the record are formatted on
  437. the screen. See the next section for details.
  438. X
  439. @vindex forms-field-sep
  440. @item forms-field-sep
  441. This variable may be used to designate the string which separates the fields
  442. in the records of the data file. If not set, it defaults to a string
  443. containing a single @code{TAB} character. @*
  444. Example:
  445. @example
  446. (setq forms-field-sep "\t")
  447. @end example
  448. X
  449. @vindex forms-number-of-fields
  450. @item forms-number-of-fields
  451. This variable holds the number of fields in each record of the data
  452. file.@*
  453. Example:
  454. @example
  455. (setq forms-number-of-fields 10)
  456. @end example
  457. X
  458. @vindex forms-read-only
  459. @item forms-read-only
  460. If set to a value other than @code{nil}, the data file is treated
  461. read-only. If the data file can not be written into, read-only mode is
  462. enforced. The default value for @code{forms-read-only} is derieved from
  463. the access permissions of the data file.@*
  464. Example:
  465. @example
  466. (set forms-read-only t)
  467. @end example
  468. X
  469. @vindex forms-multi-line
  470. @item forms-multi-line
  471. This variable may be set to allow multi-line text in fields. It should
  472. be set to a string of one character, which denotes the pseudo new-line
  473. character to be used to separate the text lines.@*
  474. Its default value is Control-K (octal 013). If set to @code{nil},
  475. multi-line text fields are prohibited.@*
  476. It may not be a character contained in @code{forms-field-sep}.@*
  477. Example:
  478. @example
  479. (setq forms-multi-line "\C-k")
  480. @end example
  481. X
  482. @end table
  483. X
  484. Of these fields, only @code{forms-file}, @code{forms-number-of-fields}
  485. and @code{forms-format-list} are mandatory. An error will be given if
  486. one of these variables has not been set. All other variables have
  487. default values which are suitable for most applications.
  488. X
  489. Two more variables may be used:
  490. @code{forms-forms-scroll} and @code{forms-forms-jump}.
  491. @xref{Forms Mode Commands} for their descriptions.
  492. X
  493. @findex{forms-new-record-filter}
  494. Optionally, the control file may define a function
  495. @code{forms-new-record-filter}. If so, this function is called when a
  496. new record is created to supply default values for fields.
  497. X
  498. @node Forms Format Description, Modifying Forms Contents, Control File Format, Top
  499. @section The forms format description
  500. X
  501. @vindex forms-format-list
  502. The value of the variable @code{forms-format-list} is used to specify
  503. the format of the forms. It must be a @code{list} of formatting elements,
  504. each of which can be either a @code{string} or a @code{number}. The
  505. formatting elements are processed in the order they appear in the list.
  506. X
  507. A @code{string} formatting element is inserted in the forms ``as is''.
  508. X
  509. A @code{number} element selects a field of the record. The contents of
  510. this field are inserted. The first field of the record has number 1
  511. (one).
  512. X
  513. If a record does not contain the number of fields as specified in
  514. @code{forms-number-of-fields}, a warning message will be printed. Excess
  515. fields are ignored, missing fields are set to empty.
  516. X
  517. The control file which shows your @file{/etc/passwd} file as demonstrated
  518. in the beginning of this document looks as follows:
  519. @example
  520. ;; This demo visits /etc/passwd.
  521. X
  522. (setq forms-file "/etc/passwd")
  523. (setq forms-number-of-fields 7)
  524. (setq forms-read-only t)                 ; to make sure
  525. (setq forms-field-sep ":")
  526. (setq forms-multi-line nil)              ; not allowed
  527. X
  528. (setq forms-format-list
  529. X     '("====== /etc/passwd ======\n\n"
  530. X       "User : "    1
  531. X       "   Uid: "   3
  532. X       "   Gid: "   4
  533. X       "\n\n"
  534. X       "Name : "    5
  535. X       "\n\n"
  536. X       "Home : "    6
  537. X       "\n\n"
  538. X       "Shell: "    7
  539. X       "\n"))
  540. @end example
  541. X
  542. Upon startup, the contents of @code{forms-format-list} are
  543. validated. If errors are encountered, processing is aborted with 
  544. an error message which includes a descriptive text. @xref{Error
  545. Messages}, for a detailed list of error messages.
  546. X
  547. @node Modifying Forms Contents, Forms Mode Commands, Forms Format Description, Top
  548. @section Modifying The Forms Contents
  549. X
  550. If a forms is not read-only, it's contents can be modified.
  551. X
  552. All normal editor commands may be used to change the forms. There is no
  553. distinction between the ``fixed'' text and the text from the fields of
  554. the records. However, upon completion, the forms is parsed to extract
  555. the new contents of the fields. The ``fixed'' portions of the forms are
  556. used to delimit the fields, these portions should therefore not be
  557. modified to avoid the risk that the field contents cannot be determined.
  558. Moreover, ambiguous field contents, which can not be discriminated from
  559. ``fixed'' text, must be avoided.
  560. X
  561. If the contents of the forms cannot be recognized properly, this is
  562. signaled using a descriptive text. @xref{Error Messages}, for more info.
  563. The cursor will indicate the last part of the forms which was
  564. successfully parsed.
  565. X
  566. @node Forms Mode Commands, Key Bindings, Modifying Forms Contents, Top
  567. @section Forms mode commands
  568. X
  569. @table @kbd
  570. @findex forms-find-file
  571. @item M-x forms-find-file @var{file}
  572. @end table
  573. X
  574. Visits @var{file}, runs @code{eval-current-buffer} on it, and puts the
  575. buffer into forms-mode. The first record of the data file will be loaded
  576. and shown.
  577. X
  578. The modeline will display the major mode @code{"Forms"} followed by the
  579. minor mode @code{"View"} if the file is visited read-only.  The number
  580. of the current record (@var{n}) and the total number of records
  581. (@var{t}) in the file is shown in the modeline as @code{"n/t"}.@*
  582. For example:
  583. @example
  584. --%%-Emacs: passwd-demo          (Forms View 1/54)----All-------
  585. @end example
  586. X
  587. @table @kbd
  588. @findex forms-find-file-other-window
  589. @item M-x forms-find-file-other-window @var{file}
  590. @end table
  591. X
  592. This command is similar to @code{forms-find-file}, but visits the file
  593. in another window.
  594. X
  595. If the buffer is not read-only, you may change the buffer to modify the
  596. fields in the record. When the current record is left, e.g. by switching
  597. to another record, the contents of the buffer are parsed using the
  598. specifications in @code{forms-format-list}, and a new record is constructed
  599. which replaces the current record in the data file. Fields of the record
  600. which are not shown in the forms are not modified; they retain their
  601. original contents.
  602. X
  603. Most forms mode commands are bound to keys, and are accessible with the
  604. conventional @code{C-c} prefix. In read-only mode this prefix is not used.
  605. @xref{Key Bindings}, for the default key bindigs used by forms mode.
  606. X
  607. The following commands are available within forms mode.
  608. X
  609. @table @kbd
  610. @findex forms-next-record
  611. @item forms-next-record
  612. shows the next record. With a prefix argument, show the n-th next
  613. record.
  614. X
  615. @findex forms-prev-record
  616. @item forms-prev-record
  617. shows the previous record. With a prefix argument, show the n-th previous
  618. record.
  619. X
  620. @findex forms-jump-record
  621. @item forms-jump-record
  622. jumps to a record by number. A prefix argument is used for the record
  623. number to jump to. If no prefix argument is supplied, a record number is
  624. asked for in the minibuffer.@*
  625. If an invalid record number is supplied, an error message is displayed
  626. reading the offending record number, and the allowable range of numbers.
  627. X
  628. @findex forms-first-record
  629. @item forms-first-record
  630. jumps to the first record.
  631. X
  632. @findex forms-last-record
  633. @item forms-last-record
  634. jumps to the last record. Also re-counts the number of records in the data
  635. file.
  636. X
  637. @findex forms-next-field
  638. @item forms-next-field
  639. jumps to the next field in the forms. With a numeric argument: jumps
  640. that many fields, or to the first field if there are not that many
  641. fields left.
  642. X
  643. Jumping to fields is implemented using markers, which are placed
  644. in front of the fields. If the contents of the forms are modified, the
  645. markers are adjusted. However, if text around a marker has been deleted
  646. from the screen and inserted again it is possible that this marker no
  647. longer points at its field correctly.
  648. @xref{Markers,,Markers, emacs, the GNU Emacs Lisp Manual}, for more
  649. information on markers.
  650. X
  651. @findex forms-view-mode
  652. @item forms-view-mode
  653. switches to read-only mode. Forms mode commands may no longer be prefixed
  654. with @code{C-c}.
  655. X
  656. @findex forms-edit-mode
  657. @item forms-edit-mode
  658. switches to edit mode. Forms mode commands must be prefixed with
  659. @code{C-c}.@*
  660. Switching to edit mode is only possible if write access to the data
  661. file is allowed.
  662. X
  663. @findex forms-insert-record
  664. @item forms-insert-record
  665. create a new record, which is inserted before the current record. An
  666. empty form is presented, which can be filled in using familiar editor
  667. commands. With a prefix argument: the new record is created @i{after} the
  668. current one.
  669. X
  670. If a function @code{forms-new-record-filter} was defined in the control
  671. file, this function is called to fill in default values for fields. The
  672. function is passed a vector of empty strings, one for each field. For
  673. convenience, an additional element is added so the numbers of the
  674. elements are the same as the numbers used in the forms description. The
  675. function must return the (updated) vector.
  676. X
  677. Example:
  678. @example
  679. (defun forms-new-record-filter (fields)
  680. X  (aset fields 5 (login-name))
  681. X  (aset fields 1 (current-time-string))
  682. X  ;; and return it
  683. X  fields)
  684. @end example
  685. X
  686. @findex forms-delete-record
  687. @item forms-delete-record
  688. deletes the current record. You are prompted for confirmation before the
  689. record is deleted unless a prefix argument has been provided.
  690. X
  691. @findex forms-search
  692. @item forms-search @var{regexp}
  693. searches for @var{regexp} in all records following this one. If found,
  694. this record is shown.@*
  695. The next time it is invoked, the previous regexp is the default, so you
  696. can do repeated searches by simply pressing @key{RET} in response to the
  697. prompt.
  698. X
  699. @findex revert-buffer
  700. @item revert-buffer
  701. reverts a possibly modified forms to its original state. It only affect
  702. the record currently in the forms.
  703. X
  704. @findex forms-exit
  705. @item forms-exit
  706. terminates forms processing. The data file is saved
  707. if it has been modified.
  708. X
  709. @findex forms-exit-no-save
  710. @item forms-exit-no-save
  711. aborts forms processing. If the data file has been modified Emacs will
  712. ask questions.
  713. X
  714. @findex describe-mode
  715. @item describe-mode
  716. gives additional help.
  717. X
  718. @findex save-buffer
  719. @item save-buffer
  720. saves the changes in the data file, if modified.
  721. X
  722. @end table
  723. X
  724. @vindex forms-forms-scroll
  725. @findex scroll-up
  726. @findex scroll-down
  727. If the variable @code{forms-forms-scrolls} is set to a value other
  728. than @code{nil} (which it is, by default), the Emacs functions
  729. @code{scroll-up} and @code{scroll-down} will perform a
  730. @code{forms-next-record} and @code{forms-prev-record} when in forms
  731. mode.  So you can use your favourite page commands to page through the
  732. data file.
  733. X
  734. @vindex forms-forms-jump
  735. @findex beginning-of-buffer
  736. @findex end-of-buffer
  737. Likewise, if the variable @code{forms-forms-jump} is not @code{nil}
  738. (which it is, by default), Emacs functions @code{beginning-of-buffer}
  739. and @code{end-of-buffer} will perform @code{forms-first-record} and
  740. @code{forms-last-record} when in forms mode.
  741. X
  742. @vindex forms-mode-hooks
  743. After forms mode is entered, functions contained in
  744. @code{forms-mode-hooks} are executed to perform user defined customization.
  745. X
  746. @node Key Bindings, Miscellaneous, Forms Mode Commands, Top
  747. @section Key bindings
  748. X
  749. This section describes the key bindings as they are defined when
  750. invoking forms mode.@*
  751. All commands must be prefixed with @kbd{C-c} when editing a forms. If a
  752. forms is read-only, @kbd{C-c} is not used.  The only exception to
  753. this rule is @code{forms-next-field}, which is bound to @kbd{TAB} in all
  754. maps.
  755. X
  756. @table @kbd
  757. X
  758. @itemx C-c @key{TAB}
  759. @code{forms-next-field}
  760. X
  761. @itemx C-c @key{SPC}
  762. @code{forms-next-record}
  763. X
  764. @itemx C-c <
  765. @code{forms-first-record}
  766. X
  767. @itemx C-c >
  768. @code{forms-first-record}
  769. X
  770. @itemx C-c d
  771. @code{forms-delete-record}
  772. X
  773. @itemx C-c e
  774. @code{forms-edit-mode}
  775. X
  776. @itemx C-c i
  777. @code{forms-insert-record}
  778. X
  779. @itemx C-c j
  780. @code{forms-jump-record}
  781. X
  782. @itemx C-c n
  783. @code{forms-next-record}
  784. X
  785. @itemx C-c p
  786. @code{forms-prev-record}
  787. X
  788. @itemx C-c q
  789. @code{forms-exit}
  790. X
  791. @itemx C-c s @var{regexp} 
  792. @code{forms-search}
  793. X
  794. @itemx C-c v
  795. @code{forms-view-mode}
  796. X
  797. @itemx C-c x
  798. @code{forms-exit-no-save}
  799. X
  800. @itemx C-c ?
  801. @code{describe-mode}
  802. X
  803. @itemx C-c @key{DEL}
  804. @code{forms-prev-record}
  805. SHAR_EOF
  806. true || echo 'restore of forms.ti failed'
  807. fi
  808. echo 'End of forms part 1'
  809. echo 'File forms.ti is continued in part 2'
  810. echo 2 > _shar_seq_.tmp
  811. exit 0
  812. -- 
  813. Johan Vromans                       jv@mh.nl via internet backbones
  814. Multihouse Automatisering bv               uucp: ..!{uunet,hp4nl}!mh.nl!jv
  815. Doesburgweg 7, 2803 PL Gouda, The Netherlands  phone/fax: +31 1820 62911/62500
  816. ------------------------ "Arms are made for hugging" -------------------------
  817.