diff options
| author | Richard M. Stallman | 1995-04-25 17:44:28 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-04-25 17:44:28 +0000 |
| commit | 2996d9f84805e1b0c128f5e90dbfcf3a21af2117 (patch) | |
| tree | beba074f83b3319fd9edac2f9450983b034e41c1 | |
| parent | 4a3393e4f53f7ea2e3e86a691a36822dc1a05877 (diff) | |
| download | emacs-2996d9f84805e1b0c128f5e90dbfcf3a21af2117.tar.gz emacs-2996d9f84805e1b0c128f5e90dbfcf3a21af2117.zip | |
(forms--make-format-elt-using-text-properties)
forms--make-format): Add `intangible' text property to read-only areas.
(forms-next-field, forms-previous-field): Use
`inhibit-point-motion-hooks' to allow move between two
intangible areas.
| -rw-r--r-- | lisp/forms.el | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lisp/forms.el b/lisp/forms.el index e9b0ee0de4d..c8b22344841 100644 --- a/lisp/forms.el +++ b/lisp/forms.el | |||
| @@ -1,8 +1,7 @@ | |||
| 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 | ;;; Copyright (C) 1991, 1995 Free Software Foundation, Inc. | 2 | ;;; Copyright (C) 1991, 1994, 1995 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | ;; Author: Johan Vromans <jv@nl.net> | 4 | ;; Author: Johan Vromans <jv@nl.net> |
| 5 | ;; Version: $Revision: 2.12 $ | ||
| 6 | 5 | ||
| 7 | ;; This file is part of GNU Emacs. | 6 | ;; This file is part of GNU Emacs. |
| 8 | 7 | ||
| @@ -155,6 +154,8 @@ | |||
| 155 | ;;; modified (using text-property `read-only'). | 154 | ;;; modified (using text-property `read-only'). |
| 156 | ;;; Also, the read-write fields are shown using a | 155 | ;;; Also, the read-write fields are shown using a |
| 157 | ;;; distinct face, if possible. | 156 | ;;; distinct face, if possible. |
| 157 | ;;; As of emacs 19.29, the `intangible' text property | ||
| 158 | ;;; is used to prevent moving into read-only fields. | ||
| 158 | ;;; This variable defaults to t if running Emacs 19 | 159 | ;;; This variable defaults to t if running Emacs 19 |
| 159 | ;;; with text properties. | 160 | ;;; with text properties. |
| 160 | ;;; The default face to show read-write fields is | 161 | ;;; The default face to show read-write fields is |
| @@ -281,10 +282,10 @@ | |||
| 281 | (provide 'forms) ;;; official | 282 | (provide 'forms) ;;; official |
| 282 | (provide 'forms-mode) ;;; for compatibility | 283 | (provide 'forms-mode) ;;; for compatibility |
| 283 | 284 | ||
| 284 | (defconst forms-version (substring "$Revision: 2.12 $" 11 -2) | 285 | (defconst forms-version (substring "$Revision: 2.14 $" 11 -2) |
| 285 | "The version number of forms-mode (as string). The complete RCS id is: | 286 | "The version number of forms-mode (as string). The complete RCS id is: |
| 286 | 287 | ||
| 287 | $Id: forms.el,v 2.12 1995/01/05 12:32:28 jvromans Exp jvromans $") | 288 | $Id: forms.el,v 2.14 1995/04/16 14:02:14 jv Exp $") |
| 288 | 289 | ||
| 289 | (defvar forms-mode-hooks nil | 290 | (defvar forms-mode-hooks nil |
| 290 | "Hook functions to be run upon entering Forms mode.") | 291 | "Hook functions to be run upon entering Forms mode.") |
| @@ -884,7 +885,7 @@ Commands: Equivalent keys in read-only mode: | |||
| 884 | (,@ (if (numberp (car forms-format-list)) | 885 | (,@ (if (numberp (car forms-format-list)) |
| 885 | nil | 886 | nil |
| 886 | '((add-text-properties (point-min) (1+ (point-min)) | 887 | '((add-text-properties (point-min) (1+ (point-min)) |
| 887 | '(front-sticky (read-only)))))) | 888 | '(front-sticky (read-only intangible)))))) |
| 888 | ;; Prevent insertion after the last text. | 889 | ;; Prevent insertion after the last text. |
| 889 | (remove-text-properties (1- (point)) (point) | 890 | (remove-text-properties (1- (point)) (point) |
| 890 | '(rear-nonsticky))) | 891 | '(rear-nonsticky))) |
| @@ -968,8 +969,10 @@ Commands: Equivalent keys in read-only mode: | |||
| 968 | (point)) | 969 | (point)) |
| 969 | (list 'face forms--ro-face ; read-only appearance | 970 | (list 'face forms--ro-face ; read-only appearance |
| 970 | 'read-only (,@ (list (1+ forms--marker))) | 971 | 'read-only (,@ (list (1+ forms--marker))) |
| 972 | 'intangible t | ||
| 971 | 'insert-in-front-hooks '(forms--iif-hook) | 973 | 'insert-in-front-hooks '(forms--iif-hook) |
| 972 | 'rear-nonsticky '(face read-only insert-in-front-hooks)))))) | 974 | 'rear-nonsticky '(face read-only insert-in-front-hooks |
| 975 | intangible)))))) | ||
| 973 | 976 | ||
| 974 | ((numberp el) | 977 | ((numberp el) |
| 975 | (` ((let ((here (point))) | 978 | (` ((let ((here (point))) |
| @@ -995,8 +998,10 @@ Commands: Equivalent keys in read-only mode: | |||
| 995 | (point)) | 998 | (point)) |
| 996 | (list 'face forms--ro-face | 999 | (list 'face forms--ro-face |
| 997 | 'read-only (,@ (list (1+ forms--marker))) | 1000 | 'read-only (,@ (list (1+ forms--marker))) |
| 1001 | 'intangible t | ||
| 998 | 'insert-in-front-hooks '(forms--iif-hook) | 1002 | 'insert-in-front-hooks '(forms--iif-hook) |
| 999 | 'rear-nonsticky '(read-only face insert-in-front-hooks)))))) | 1003 | 'rear-nonsticky '(read-only face insert-in-front-hooks |
| 1004 | intangible)))))) | ||
| 1000 | 1005 | ||
| 1001 | ;; end of cond | 1006 | ;; end of cond |
| 1002 | )) | 1007 | )) |
| @@ -1891,7 +1896,8 @@ Calls `forms-write-file-filter' before writing out the data." | |||
| 1891 | (let ((i 0) | 1896 | (let ((i 0) |
| 1892 | (here (point)) | 1897 | (here (point)) |
| 1893 | there | 1898 | there |
| 1894 | (cnt 0)) | 1899 | (cnt 0) |
| 1900 | (inhibit-point-motion-hooks t)) | ||
| 1895 | 1901 | ||
| 1896 | (if (zerop arg) | 1902 | (if (zerop arg) |
| 1897 | (setq cnt 1) | 1903 | (setq cnt 1) |
| @@ -1917,7 +1923,8 @@ Calls `forms-write-file-filter' before writing out the data." | |||
| 1917 | (let ((i (length forms--markers)) | 1923 | (let ((i (length forms--markers)) |
| 1918 | (here (point)) | 1924 | (here (point)) |
| 1919 | there | 1925 | there |
| 1920 | (cnt 0)) | 1926 | (cnt 0) |
| 1927 | (inhibit-point-motion-hooks t)) | ||
| 1921 | 1928 | ||
| 1922 | (if (zerop arg) | 1929 | (if (zerop arg) |
| 1923 | (setq cnt 1) | 1930 | (setq cnt 1) |