(Fcurrent_time_zone) [HAVE_TM_ZONE || HAVE_TZNAME]:
[emacs.git] / lisp / forms-d2.el
blob22331292e142a4871b7552691f5469a77dcff925
1 ;;; forms-d2.el --- demo forms-mode
3 ;; Author: Johan Vromans <jvromans@squirrel.nl>
4 ;; Created: 1989
6 ;; This sample forms exploit most of the features of forms mode.
8 ;; Set the name of the data file.
9 (setq forms-file "forms-d2.dat")
11 ;; Use 'forms-enumerate' to set field names and number thereof.
12 (setq forms-number-of-fields
13 (forms-enumerate
14 '(arch-newsgroup ; 1
15 arch-volume ; 2
16 arch-issue ; and ...
17 arch-article ; ... so
18 arch-shortname ; ... ... on
19 arch-parts
20 arch-from
21 arch-longname
22 arch-keywords
23 arch-date
24 arch-remarks)))
26 ;; The following functions are used by this form for layout purposes.
28 (defun arch-tocol (target &optional fill)
29 "Produces a string to skip to column TARGET. Prepends newline if needed.
30 The optional FILL should be a character, used to fill to the column."
31 (if (null fill)
32 (setq fill ? ))
33 (if (< target (current-column))
34 (concat "\n" (make-string target fill))
35 (make-string (- target (current-column)) fill)))
37 (defun arch-rj (target field &optional fill)
38 "Produces a string to skip to column TARGET minus the width of field FIELD.
39 Prepends newline if needed. The optional FILL should be a character,
40 used to fill to the column."
41 (arch-tocol (- target (length (nth field forms-fields))) fill))
43 ;; Record filters.
45 (defun arch-new-record-filter (the-record)
46 "Form a new record with some defaults."
47 (aset the-record arch-from (user-full-name))
48 (aset the-record arch-date (current-time-string))
49 the-record ; return it
51 (setq forms-new-record-filter 'arch-new-record-filter)
53 ;; The format list.
54 (setq forms-format-list
55 (list
56 "====== Public Domain Software Archive ======\n\n"
57 arch-shortname
58 " - " arch-longname
59 "\n\n"
60 "Article: " arch-newsgroup
61 "/" arch-article
62 " "
63 '(arch-tocol 40)
64 "Issue: " arch-issue
65 " "
66 '(arch-rj 73 10)
67 "Date: " arch-date
68 "\n\n"
69 "Submitted by: " arch-from
70 "\n"
71 '(arch-tocol 79 ?-)
72 "\n"
73 "Keywords: " arch-keywords
74 "\n\n"
75 "Parts: " arch-parts
76 "\n\n====== Remarks ======\n\n"
77 arch-remarks
80 ;; That's all, folks!