Function: forms--show-record

forms--show-record is a byte-compiled function defined in forms.el.gz.

Signature

(forms--show-record THE-RECORD)

Documentation

Format THE-RECORD and display it in the current buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/forms.el.gz
(defun forms--show-record (the-record)
  "Format THE-RECORD and display it in the current buffer."

  ;; Split the-record.
  (let (the-result
	(start-pos 0)
	found-pos
	(field-sep-length (length forms-field-sep)))
    (if forms-multi-line
	(forms--trans the-record forms-multi-line "\n"))
    ;; Add an extra separator (makes splitting easy).
    (setq the-record (concat the-record forms-field-sep))
    (while (setq found-pos (string-match forms-field-sep the-record start-pos))
      (let ((ent (substring the-record start-pos found-pos)))
	(setq the-result
	      (append the-result (list ent)))
	(setq start-pos (+ field-sep-length found-pos))))
    (setq forms--the-record-list the-result))

  (setq buffer-read-only nil)
  (if forms-use-text-properties
      (let ((inhibit-read-only t))
	(set-text-properties (point-min) (point-max) nil)))
  (erase-buffer)

  ;; Verify the number of fields, extend forms--the-record-list if needed.
  (if (= (length forms--the-record-list) forms-number-of-fields)
      nil
    (if (null forms-check-number-of-fields)
	nil
      (message "Warning: this record has %d fields instead of %d"
	       (length forms--the-record-list) forms-number-of-fields))
    (if (< (length forms--the-record-list) forms-number-of-fields)
	(setq forms--the-record-list
	      (append forms--the-record-list
		      (make-list
		       (- forms-number-of-fields
			  (length forms--the-record-list))
		       "")))))

  ;; Call the formatter function.
  (setq forms-fields (append (list nil) forms--the-record-list nil))
  (funcall forms--format forms--the-record-list)

  ;; Prepare.
  (goto-char (point-min))
  (set-buffer-modified-p nil)
  (setq buffer-read-only forms-read-only)
  (setq mode-line-process
	(concat " " (int-to-string forms--current-record)
		"/" (int-to-string forms--total-records))))