diff options
Diffstat (limited to 'lisp/forms.el')
| -rw-r--r-- | lisp/forms.el | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/lisp/forms.el b/lisp/forms.el index 37914bf5465..38fc0b320dd 100644 --- a/lisp/forms.el +++ b/lisp/forms.el | |||
| @@ -439,6 +439,8 @@ Also, initial position is at last record." | |||
| 439 | (defvar forms--rw-face nil | 439 | (defvar forms--rw-face nil |
| 440 | "Face used to represent read-write data on the screen.") | 440 | "Face used to represent read-write data on the screen.") |
| 441 | 441 | ||
| 442 | (defvar read-file-filter) ; bound in forms--intuit-from-file | ||
| 443 | |||
| 442 | ;;;###autoload | 444 | ;;;###autoload |
| 443 | (defun forms-mode (&optional primary) | 445 | (defun forms-mode (&optional primary) |
| 444 | "Major mode to visit files in a field-structured manner using a form. | 446 | "Major mode to visit files in a field-structured manner using a form. |
| @@ -913,7 +915,7 @@ Commands: Equivalent keys in read-only mode: | |||
| 913 | `(lambda (arg) | 915 | `(lambda (arg) |
| 914 | (let ((inhibit-read-only t)) | 916 | (let ((inhibit-read-only t)) |
| 915 | ,@(apply 'append | 917 | ,@(apply 'append |
| 916 | (mapcar 'forms--make-format-elt-using-text-properties | 918 | (mapcar #'forms--make-format-elt-using-text-properties |
| 917 | forms-format-list)) | 919 | forms-format-list)) |
| 918 | ;; Prevent insertion before the first text. | 920 | ;; Prevent insertion before the first text. |
| 919 | ,@(if (numberp (car forms-format-list)) | 921 | ,@(if (numberp (car forms-format-list)) |
| @@ -926,7 +928,7 @@ Commands: Equivalent keys in read-only mode: | |||
| 926 | (setq forms--iif-start nil)) | 928 | (setq forms--iif-start nil)) |
| 927 | `(lambda (arg) | 929 | `(lambda (arg) |
| 928 | ,@(apply 'append | 930 | ,@(apply 'append |
| 929 | (mapcar 'forms--make-format-elt forms-format-list))))) | 931 | (mapcar #'forms--make-format-elt forms-format-list))))) |
| 930 | 932 | ||
| 931 | ;; We have tallied the number of markers and dynamic texts, | 933 | ;; We have tallied the number of markers and dynamic texts, |
| 932 | ;; so we can allocate the arrays now. | 934 | ;; so we can allocate the arrays now. |
| @@ -1098,7 +1100,7 @@ Commands: Equivalent keys in read-only mode: | |||
| 1098 | (goto-char (point-min)) | 1100 | (goto-char (point-min)) |
| 1099 | ,@(apply 'append | 1101 | ,@(apply 'append |
| 1100 | (mapcar | 1102 | (mapcar |
| 1101 | 'forms--make-parser-elt | 1103 | #'forms--make-parser-elt |
| 1102 | (append forms-format-list (list nil))))))))) | 1104 | (append forms-format-list (list nil))))))))) |
| 1103 | 1105 | ||
| 1104 | (forms--debug 'forms--parser)) | 1106 | (forms--debug 'forms--parser)) |
| @@ -1198,8 +1200,6 @@ Commands: Equivalent keys in read-only mode: | |||
| 1198 | (setq forms--field nil))) | 1200 | (setq forms--field nil))) |
| 1199 | )) | 1201 | )) |
| 1200 | 1202 | ||
| 1201 | (defvar read-file-filter) ; bound in forms--intuit-from-file | ||
| 1202 | |||
| 1203 | (defun forms--intuit-from-file () | 1203 | (defun forms--intuit-from-file () |
| 1204 | "Get number of fields and a default form using the data file." | 1204 | "Get number of fields and a default form using the data file." |
| 1205 | 1205 | ||
| @@ -1569,10 +1569,10 @@ As a side effect: sets `forms--the-record-list'." | |||
| 1569 | ;; Build new record. | 1569 | ;; Build new record. |
| 1570 | (setq forms--the-record-list (forms--parse-form)) | 1570 | (setq forms--the-record-list (forms--parse-form)) |
| 1571 | (setq the-record | 1571 | (setq the-record |
| 1572 | (mapconcat 'identity forms--the-record-list forms-field-sep)) | 1572 | (mapconcat #'identity forms--the-record-list forms-field-sep)) |
| 1573 | 1573 | ||
| 1574 | (if (string-match (regexp-quote forms-field-sep) | 1574 | (if (string-match-p (regexp-quote forms-field-sep) |
| 1575 | (mapconcat 'identity forms--the-record-list "")) | 1575 | (mapconcat #'identity forms--the-record-list "")) |
| 1576 | (error "Field separator occurs in record - update refused")) | 1576 | (error "Field separator occurs in record - update refused")) |
| 1577 | 1577 | ||
| 1578 | ;; Handle multi-line fields, if allowed. | 1578 | ;; Handle multi-line fields, if allowed. |
| @@ -1580,7 +1580,7 @@ As a side effect: sets `forms--the-record-list'." | |||
| 1580 | (forms--trans the-record "\n" forms-multi-line)) | 1580 | (forms--trans the-record "\n" forms-multi-line)) |
| 1581 | 1581 | ||
| 1582 | ;; A final sanity check before updating. | 1582 | ;; A final sanity check before updating. |
| 1583 | (if (string-match "\n" the-record) | 1583 | (if (string-match-p "\n" the-record) |
| 1584 | (error "Multi-line fields in this record - update refused")) | 1584 | (error "Multi-line fields in this record - update refused")) |
| 1585 | 1585 | ||
| 1586 | (with-current-buffer forms--file-buffer | 1586 | (with-current-buffer forms--file-buffer |
| @@ -1779,11 +1779,7 @@ after the current record." | |||
| 1779 | (setq the-list (cdr (append the-fields nil)))) | 1779 | (setq the-list (cdr (append the-fields nil)))) |
| 1780 | (setq the-list (make-list forms-number-of-fields ""))) | 1780 | (setq the-list (make-list forms-number-of-fields ""))) |
| 1781 | 1781 | ||
| 1782 | (setq the-record | 1782 | (setq the-record (mapconcat #'identity the-list forms-field-sep)) |
| 1783 | (mapconcat | ||
| 1784 | 'identity | ||
| 1785 | the-list | ||
| 1786 | forms-field-sep)) | ||
| 1787 | 1783 | ||
| 1788 | (with-current-buffer forms--file-buffer | 1784 | (with-current-buffer forms--file-buffer |
| 1789 | (forms--goto-record ln) | 1785 | (forms--goto-record ln) |