diff options
| author | Johan Vromans | 1996-03-01 21:13:01 +0000 |
|---|---|---|
| committer | Johan Vromans | 1996-03-01 21:13:01 +0000 |
| commit | 149bb5bea46275a0354cc43158e6b7c7ef86172c (patch) | |
| tree | 32afe638bbb79d8a1d2be8d0674dacfa3986553e | |
| parent | 7b89d38e9a90b77178a3d378876c02fc84b4e8b7 (diff) | |
| download | emacs-149bb5bea46275a0354cc43158e6b7c7ef86172c.tar.gz emacs-149bb5bea46275a0354cc43158e6b7c7ef86172c.zip | |
(forms-insert-after): New variable. Non-nil means: inserts of new
records go after current record, also initial position is at last
record.
(forms-mode, forms-insert-record): Use it.
| -rw-r--r-- | lisp/forms.el | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/lisp/forms.el b/lisp/forms.el index aa20ecd561f..0aa5f0f7130 100644 --- a/lisp/forms.el +++ b/lisp/forms.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; forms.el --- Forms mode: edit a file as a form to fill in | 1 | ;;; forms.el --- Forms mode: edit a file as a form to fill in |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1991, 1994, 1995 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Johan Vromans <jvromans@squirrel.nl> | 5 | ;; Author: Johan Vromans <jvromans@squirrel.nl> |
| 6 | 6 | ||
| @@ -104,10 +104,10 @@ | |||
| 104 | ;; If no write access to the data file is | 104 | ;; If no write access to the data file is |
| 105 | ;; possible, view mode is enforced. | 105 | ;; possible, view mode is enforced. |
| 106 | ;; | 106 | ;; |
| 107 | ;; forms-check-number-of-fields [bool, default t] | 107 | ;; forms-check-number-of-fields [bool, default t] |
| 108 | ;; If non-nil, a warning will be issued whenever | 108 | ;; If non-nil, a warning will be issued whenever |
| 109 | ;; a record is found that does not have the number | 109 | ;; a record is found that does not have the number |
| 110 | ;; of fields specified by `forms-number-of-fields'. | 110 | ;; of fields specified by `forms-number-of-fields'. |
| 111 | ;; | 111 | ;; |
| 112 | ;; forms-multi-line [string, default "^K"] | 112 | ;; forms-multi-line [string, default "^K"] |
| 113 | ;; If non-null the records of the data file may | 113 | ;; If non-null the records of the data file may |
| @@ -126,8 +126,11 @@ | |||
| 126 | ;; | 126 | ;; |
| 127 | ;; forms-forms-jump [bool, default nil] | 127 | ;; forms-forms-jump [bool, default nil] |
| 128 | ;; Non-nil means: rebind locally the commands that | 128 | ;; Non-nil means: rebind locally the commands that |
| 129 | ;; perform `beginning-of-buffer' or `end-of-buffer' | 129 | ;; |
| 130 | ;; to perform `forms-first-field' resp. `forms-last-field'. | 130 | ;; forms-insert-after [bool, default nil] |
| 131 | ;; Non-nil means: inserts of new records go after | ||
| 132 | ;; current record, also initial position is at last | ||
| 133 | ;; record. | ||
| 131 | ;; | 134 | ;; |
| 132 | ;; forms-read-file-filter [symbol, default nil] | 135 | ;; forms-read-file-filter [symbol, default nil] |
| 133 | ;; If not nil: this should be the name of a | 136 | ;; If not nil: this should be the name of a |
| @@ -289,10 +292,10 @@ | |||
| 289 | (provide 'forms) ;;; official | 292 | (provide 'forms) ;;; official |
| 290 | (provide 'forms-mode) ;;; for compatibility | 293 | (provide 'forms-mode) ;;; for compatibility |
| 291 | 294 | ||
| 292 | (defconst forms-version (substring "$Revision: 2.27 $" 11 -2) | 295 | (defconst forms-version (substring "$Revision: 2.20 $" 11 -2) |
| 293 | "The version number of forms-mode (as string). The complete RCS id is: | 296 | "The version number of forms-mode (as string). The complete RCS id is: |
| 294 | 297 | ||
| 295 | $Id: forms.el,v 2.27 1996/01/25 06:16:34 kwzh Exp kwzh $") | 298 | $Id: forms.el,v 2.20 1996/03/01 20:31:29 jv Exp $") |
| 296 | 299 | ||
| 297 | (defvar forms-mode-hooks nil | 300 | (defvar forms-mode-hooks nil |
| 298 | "Hook functions to be run upon entering Forms mode.") | 301 | "Hook functions to be run upon entering Forms mode.") |
| @@ -355,6 +358,10 @@ The contents may NOT be modified.") | |||
| 355 | "*Non-nil means: use emacs-19 text properties. | 358 | "*Non-nil means: use emacs-19 text properties. |
| 356 | Defaults to t if this emacs is capable of handling text properties.") | 359 | Defaults to t if this emacs is capable of handling text properties.") |
| 357 | 360 | ||
| 361 | (defvar forms-insert-after nil | ||
| 362 | "*Non-nil means: inserts of new records go after current record. | ||
| 363 | Also, initial position is at last record.") | ||
| 364 | |||
| 358 | (defvar forms-ro-face 'default | 365 | (defvar forms-ro-face 'default |
| 359 | "The face (a symbol) that is used to display read-only text on the screen.") | 366 | "The face (a symbol) that is used to display read-only text on the screen.") |
| 360 | 367 | ||
| @@ -463,6 +470,7 @@ Commands: Equivalent keys in read-only mode: | |||
| 463 | (make-local-variable 'forms-multi-line) | 470 | (make-local-variable 'forms-multi-line) |
| 464 | (make-local-variable 'forms-forms-scroll) | 471 | (make-local-variable 'forms-forms-scroll) |
| 465 | (make-local-variable 'forms-forms-jump) | 472 | (make-local-variable 'forms-forms-jump) |
| 473 | (make-local-variable 'forms-insert-after) | ||
| 466 | (make-local-variable 'forms-use-text-properties) | 474 | (make-local-variable 'forms-use-text-properties) |
| 467 | 475 | ||
| 468 | ;; Filter functions. | 476 | ;; Filter functions. |
| @@ -685,6 +693,10 @@ Commands: Equivalent keys in read-only mode: | |||
| 685 | (forms-jump-record forms--current-record) | 693 | (forms-jump-record forms--current-record) |
| 686 | ) | 694 | ) |
| 687 | 695 | ||
| 696 | (if forms-insert-after | ||
| 697 | (forms-last-record) | ||
| 698 | (forms-first-record)) | ||
| 699 | |||
| 688 | ;; user customising | 700 | ;; user customising |
| 689 | ;;(message "forms: proceeding setup (user hooks)...") | 701 | ;;(message "forms: proceeding setup (user hooks)...") |
| 690 | (run-hooks 'forms-mode-hooks) | 702 | (run-hooks 'forms-mode-hooks) |
| @@ -1279,7 +1291,7 @@ Commands: Equivalent keys in read-only mode: | |||
| 1279 | (define-key map [menu-bar forms] | 1291 | (define-key map [menu-bar forms] |
| 1280 | (cons "Forms" (make-sparse-keymap "Forms"))) | 1292 | (cons "Forms" (make-sparse-keymap "Forms"))) |
| 1281 | (define-key map [menu-bar forms menu-forms-exit] | 1293 | (define-key map [menu-bar forms menu-forms-exit] |
| 1282 | '("Exit" . forms-exit)) | 1294 | '("Exit Forms Mode" . forms-exit)) |
| 1283 | (define-key map [menu-bar forms menu-forms-sep1] | 1295 | (define-key map [menu-bar forms menu-forms-sep1] |
| 1284 | '("----")) | 1296 | '("----")) |
| 1285 | (define-key map [menu-bar forms menu-forms-save] | 1297 | (define-key map [menu-bar forms menu-forms-save] |
| @@ -1750,15 +1762,21 @@ Otherwise enables edit mode if the visited file is writable." | |||
| 1750 | "Create a new record before the current one. | 1762 | "Create a new record before the current one. |
| 1751 | With ARG: store the record after the current one. | 1763 | With ARG: store the record after the current one. |
| 1752 | If `forms-new-record-filter' contains the name of a function, | 1764 | If `forms-new-record-filter' contains the name of a function, |
| 1753 | it is called to fill (some of) the fields with default values." | 1765 | it is called to fill (some of) the fields with default values. |
| 1766 | If `forms-insert-after is non-nil, the default behavior is to insert | ||
| 1767 | after the current record." | ||
| 1754 | 1768 | ||
| 1755 | (interactive "P") | 1769 | (interactive "P") |
| 1756 | 1770 | ||
| 1757 | (if forms-read-only | 1771 | (if forms-read-only |
| 1758 | (error "")) | 1772 | (error "")) |
| 1759 | 1773 | ||
| 1760 | (let ((ln (if arg (1+ forms--current-record) forms--current-record)) | 1774 | (let (ln the-list the-record) |
| 1761 | the-list the-record) | 1775 | |
| 1776 | (if (or (and arg forms-insert-after) | ||
| 1777 | (and (not arg) (not forms-insert-after))) | ||
| 1778 | (setq ln forms--current-record) | ||
| 1779 | (setq ln (1+ forms--current-record))) | ||
| 1762 | 1780 | ||
| 1763 | (forms--checkmod) | 1781 | (forms--checkmod) |
| 1764 | (if forms-new-record-filter | 1782 | (if forms-new-record-filter |