1 ;;; forms-d2.el --- demo forms-mode -*- no-byte-compile: t -*-
3 ;; Copyright (C) 1991, 1994-1997, 2001-2012 Free Software Foundation, Inc.
5 ;; Author: Johan Vromans <jvromans@squirrel.nl>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;; This sample forms exploit most of the features of forms mode.
29 ;; Set the name of the data file.
30 (setq forms-file
(expand-file-name "forms-d2.dat" data-directory
))
32 ;; Use 'forms-enumerate' to set field names and number thereof.
33 (setq forms-number-of-fields
39 arch-shortname
; ... ... on
47 ;; The following functions are used by this form for layout purposes.
49 (defun arch-tocol (target &optional fill
)
50 "Produces a string to skip to column TARGET. Prepends newline if needed.
51 The optional FILL should be a character, used to fill to the column."
54 (if (< target
(current-column))
55 (concat "\n" (make-string target fill
))
56 (make-string (- target
(current-column)) fill
)))
58 (defun arch-rj (target field
&optional fill
)
59 "Produces a string to skip to column TARGET minus the width of field FIELD.
60 Prepends newline if needed. The optional FILL should be a character,
61 used to fill to the column."
62 (arch-tocol (- target
(length (nth field forms-fields
))) fill
))
66 (defun arch-new-record-filter (the-record)
67 "Form a new record with some defaults."
68 (aset the-record arch-from
(user-full-name))
69 (aset the-record arch-date
(current-time-string))
70 the-record
; return it
72 (setq forms-new-record-filter
'arch-new-record-filter
)
75 (setq forms-format-list
77 "====== Public Domain Software Archive ======\n\n"
81 "Article: " arch-newsgroup
90 "Submitted by: " arch-from
94 "Keywords: " arch-keywords
97 "\n\n====== Remarks ======\n\n"
101 ;; That's all, folks!
103 ;;; forms-d2.el ends here