diff options
| author | Glenn Morris | 2012-05-07 18:53:17 -0400 |
|---|---|---|
| committer | Glenn Morris | 2012-05-07 18:53:17 -0400 |
| commit | af8630f410df429ceece61d7ceee2110d0c366a2 (patch) | |
| tree | 8c60c37d2627cddc9eb05d5b589f8919a028aee2 /etc/forms | |
| parent | 57699e3735e756ef8d11eaa77f4246aa251ec6ca (diff) | |
| download | emacs-af8630f410df429ceece61d7ceee2110d0c366a2.tar.gz emacs-af8630f410df429ceece61d7ceee2110d0c366a2.zip | |
Move some forms.el example files to etc/forms directory
* etc/forms/README: New.
* etc/forms/forms-d2.dat: Move to etc/forms/ subdirectory.
* etc/forms/forms-d2.el, etc/forms/forms-pass.el: Move here from ../lisp.
* lisp/forms.el: Related comment change.
Diffstat (limited to 'etc/forms')
| -rw-r--r-- | etc/forms/README | 1 | ||||
| -rw-r--r-- | etc/forms/forms-d2.dat | 4 | ||||
| -rw-r--r-- | etc/forms/forms-d2.el | 103 | ||||
| -rw-r--r-- | etc/forms/forms-pass.el | 33 |
4 files changed, 141 insertions, 0 deletions
diff --git a/etc/forms/README b/etc/forms/README new file mode 100644 index 00000000000..4d728450ac4 --- /dev/null +++ b/etc/forms/README | |||
| @@ -0,0 +1 @@ | |||
| This directory contains some example files for the forms.el library. | |||
diff --git a/etc/forms/forms-d2.dat b/etc/forms/forms-d2.dat new file mode 100644 index 00000000000..f6c599c9aa8 --- /dev/null +++ b/etc/forms/forms-d2.dat | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | comp.sources.unix v11i008 269 getty-enable 1 tron@sc.nsc.com (Ronald S. Karr) Getty on/off programs for 4.[23] BSD 890505 This program can be used to dynamically enable / disable terminallines on a BSD system. | ||
| 2 | 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 | ||
| 3 | comp.sources.unix 11 v11i033 290 less3 3 sun!intsc!convgt!mark The 'less' pager 02/09/1987 | ||
| 4 | comp.sources.unix 11 v11i036 293 test.el 3 "Mark A. Ardis" <maa@sei.cmu.edu> Test system for GNU Emacs 10/09/1987 | ||
diff --git a/etc/forms/forms-d2.el b/etc/forms/forms-d2.el new file mode 100644 index 00000000000..9fa2145e4d0 --- /dev/null +++ b/etc/forms/forms-d2.el | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | ;;; forms-d2.el --- demo forms-mode | ||
| 2 | |||
| 3 | ;; Copyright (C) 1991, 1994-1997, 2001-2012 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Johan Vromans <jvromans@squirrel.nl> | ||
| 6 | ;; Created: 1989 | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 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. | ||
| 14 | |||
| 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. | ||
| 19 | |||
| 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/>. | ||
| 22 | |||
| 23 | ;;; Commentary: | ||
| 24 | |||
| 25 | ;; This sample forms exploit most of the features of forms mode. | ||
| 26 | |||
| 27 | ;;; Code: | ||
| 28 | |||
| 29 | ;; Set the name of the data file. | ||
| 30 | (setq forms-file (expand-file-name "forms/forms-d2.dat" data-directory)) | ||
| 31 | |||
| 32 | ;; Use 'forms-enumerate' to set field names and number thereof. | ||
| 33 | (setq forms-number-of-fields | ||
| 34 | (forms-enumerate | ||
| 35 | '(arch-newsgroup ; 1 | ||
| 36 | arch-volume ; 2 | ||
| 37 | arch-issue ; and ... | ||
| 38 | arch-article ; ... so | ||
| 39 | arch-shortname ; ... ... on | ||
| 40 | arch-parts | ||
| 41 | arch-from | ||
| 42 | arch-longname | ||
| 43 | arch-keywords | ||
| 44 | arch-date | ||
| 45 | arch-remarks))) | ||
| 46 | |||
| 47 | ;; The following functions are used by this form for layout purposes. | ||
| 48 | ;; | ||
| 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." | ||
| 52 | (if (null fill) | ||
| 53 | (setq fill ?\s)) | ||
| 54 | (if (< target (current-column)) | ||
| 55 | (concat "\n" (make-string target fill)) | ||
| 56 | (make-string (- target (current-column)) fill))) | ||
| 57 | ;; | ||
| 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)) | ||
| 63 | |||
| 64 | ;; Record filters. | ||
| 65 | ;; | ||
| 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 | ||
| 71 | ) | ||
| 72 | (setq forms-new-record-filter 'arch-new-record-filter) | ||
| 73 | |||
| 74 | ;; The format list. | ||
| 75 | (setq forms-format-list | ||
| 76 | (list | ||
| 77 | "====== Public Domain Software Archive ======\n\n" | ||
| 78 | arch-shortname | ||
| 79 | " - " arch-longname | ||
| 80 | "\n\n" | ||
| 81 | "Article: " arch-newsgroup | ||
| 82 | "/" arch-article | ||
| 83 | " " | ||
| 84 | '(arch-tocol 40) | ||
| 85 | "Issue: " arch-issue | ||
| 86 | " " | ||
| 87 | '(arch-rj 73 10) | ||
| 88 | "Date: " arch-date | ||
| 89 | "\n\n" | ||
| 90 | "Submitted by: " arch-from | ||
| 91 | "\n" | ||
| 92 | '(arch-tocol 79 ?-) | ||
| 93 | "\n" | ||
| 94 | "Keywords: " arch-keywords | ||
| 95 | "\n\n" | ||
| 96 | "Parts: " arch-parts | ||
| 97 | "\n\n====== Remarks ======\n\n" | ||
| 98 | arch-remarks | ||
| 99 | )) | ||
| 100 | |||
| 101 | ;; That's all, folks! | ||
| 102 | |||
| 103 | ;;; forms-d2.el ends here | ||
diff --git a/etc/forms/forms-pass.el b/etc/forms/forms-pass.el new file mode 100644 index 00000000000..34d4548434b --- /dev/null +++ b/etc/forms/forms-pass.el | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | ;;; forms-pass.el --- passwd file demo for forms-mode | ||
| 2 | |||
| 3 | ;; This file is part of GNU Emacs. | ||
| 4 | |||
| 5 | ;;; Commentary: | ||
| 6 | |||
| 7 | ;; This demo visits your passwd file. | ||
| 8 | |||
| 9 | ;;; Code: | ||
| 10 | |||
| 11 | ;; use yp if present | ||
| 12 | (or (file-exists-p (setq forms-file "/var/yp/src/passwd")) | ||
| 13 | (setq forms-file "/etc/passwd")) | ||
| 14 | |||
| 15 | (setq forms-read-only t) ; to make sure | ||
| 16 | (setq forms-field-sep ":") | ||
| 17 | (setq forms-number-of-fields 7) | ||
| 18 | |||
| 19 | (setq forms-format-list | ||
| 20 | (list | ||
| 21 | "====== Visiting " forms-file " ======\n\n" | ||
| 22 | "User : " 1 | ||
| 23 | " Uid: " 3 | ||
| 24 | " Gid: " 4 | ||
| 25 | "\n\n" | ||
| 26 | "Name : " 5 | ||
| 27 | "\n\n" | ||
| 28 | "Home : " 6 | ||
| 29 | "\n\n" | ||
| 30 | "Shell: " 7 | ||
| 31 | "\n")) | ||
| 32 | |||
| 33 | ;;; forms-pass.el ends here | ||