annotate lisp/utils/forms-d2.el @ 194:2947057885e5

Added tag r20-3b23 for changeset f53b5ca2e663
author cvs
date Mon, 13 Aug 2007 09:58:32 +0200
parents ac2d302a0011
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; forms-d2.el --- demo forms-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3 ;; Author: Johan Vromans
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
4 ;; Created: 1989
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
5
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
6 ;;; Synched up with: FSF 19.34.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; This sample forms exploit most of the features of forms mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; Set the name of the data file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 (setq forms-file "forms-d2.dat")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; Use 'forms-enumerate' to set field names and number thereof.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 (setq forms-number-of-fields
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 (forms-enumerate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 '(arch-newsgroup ; 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 arch-volume ; 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 arch-issue ; and ...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 arch-article ; ... so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 arch-shortname ; ... ... on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 arch-parts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 arch-from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 arch-longname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 arch-keywords
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 arch-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 arch-remarks)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; The following functions are used by this form for layout purposes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (defun arch-tocol (target &optional fill)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 "Produces a string to skip to column TARGET. Prepends newline if needed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 The optional FILL should be a character, used to fill to the column."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (if (null fill)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (setq fill ? ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (if (< target (current-column))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (concat "\n" (make-string target fill))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (make-string (- target (current-column)) fill)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (defun arch-rj (target field &optional fill)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 "Produces a string to skip to column TARGET minus the width of field FIELD.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 Prepends newline if needed. The optional FILL should be a character,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 used to fill to the column."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (arch-tocol (- target (length (nth field forms-fields))) fill))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; Record filters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;;
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
47 (defun arch-new-record-filter (the-record)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 "Form a new record with some defaults."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (aset the-record arch-from (user-full-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (aset the-record arch-date (current-time-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 the-record ; return it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 )
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
53 (setq forms-new-record-filter 'arch-new-record-filter)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;; The format list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (setq forms-format-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 "====== Public Domain Software Archive ======\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 arch-shortname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 " - " arch-longname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 "\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 "Article: " arch-newsgroup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 "/" arch-article
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 '(arch-tocol 40)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 "Issue: " arch-issue
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 '(arch-rj 73 10)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 "Date: " arch-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 "\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 "Submitted by: " arch-from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 "\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 '(arch-tocol 79 ?-)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 "\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 "Keywords: " arch-keywords
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 "\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 "Parts: " arch-parts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 "\n\n====== Remarks ======\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 arch-remarks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ;; That's all, folks!