Function: forms--make-format

forms--make-format is a byte-compiled function defined in forms.el.gz.

Signature

(forms--make-format)

Documentation

Generate forms--format using the information in forms-format-list.

Source Code

;; Defined in /usr/src/emacs/lisp/forms.el.gz
(defun forms--make-format ()
  "Generate `forms--format' using the information in `forms-format-list'."

  ;; The real work is done using a mapcar of `forms--make-format-elt' on
  ;; `forms-format-list'.
  ;; This function sets up the necessary environment, and decides
  ;; which function to mapcar.

  (let ((forms--marker 0)
	(forms--dyntext 0))
    (setq
     forms--format
     (if forms-use-text-properties
	 `(lambda (arg)
	    (let ((inhibit-read-only t))
	      ,@(apply #'append
		       (mapcar #'forms--make-format-elt-using-text-properties
			       forms-format-list))
	      ;; Prevent insertion before the first text.
	      ,@(if (numberp (car forms-format-list))
		    nil
		  '((add-text-properties (point-min) (1+ (point-min))
					 '(front-sticky (read-only cursor-intangible)))))
	      ;; Prevent insertion after the last text.
	      (remove-text-properties (1- (point)) (point)
                                      '(rear-nonsticky nil)))
	    (setq forms--iif-start nil))
       `(lambda (arg)
	  ,@(apply #'append
		   (mapcar #'forms--make-format-elt forms-format-list)))))

    ;; We have tallied the number of markers and dynamic texts,
    ;; so we can allocate the arrays now.
    (setq forms--markers (make-vector forms--marker nil))
    (setq forms--dyntexts (make-vector forms--dyntext nil)))
  (forms--debug 'forms--format))