Function: forms--update
forms--update is a byte-compiled function defined in forms.el.gz.
Signature
(forms--update)
Documentation
Update current record with contents of form.
As a side effect: sets forms--the-record-list.
Source Code
;; Defined in /usr/src/emacs/lisp/forms.el.gz
(defun forms--update ()
"Update current record with contents of form.
As a side effect: sets `forms--the-record-list'."
(if forms-read-only
(error "Buffer is read-only"))
(let (the-record)
;; Build new record.
(setq forms--the-record-list (forms--parse-form))
(setq the-record
(mapconcat #'identity forms--the-record-list forms-field-sep))
(if (string-match-p (regexp-quote forms-field-sep)
(mapconcat #'identity forms--the-record-list ""))
(error "Field separator occurs in record - update refused"))
;; Handle multi-line fields, if allowed.
(if forms-multi-line
(forms--trans the-record "\n" forms-multi-line))
;; A final sanity check before updating.
(if (string-search "\n" the-record)
(error "Multi-line fields in this record - update refused"))
(with-current-buffer forms--file-buffer
;; Use delete-region instead of kill-region, to avoid
;; adding junk to the kill-ring.
(delete-region (line-beginning-position) (line-end-position))
(insert the-record)
(beginning-of-line))))