Function: widget-choice-value-create

widget-choice-value-create is a byte-compiled function defined in wid-edit.el.gz.

Signature

(widget-choice-value-create WIDGET)

Documentation

Insert the first choice that matches the value.

Source Code

;; Defined in /usr/src/emacs/lisp/wid-edit.el.gz
(defun widget-choice-value-create (widget)
  "Insert the first choice that matches the value."
  (let ((value (widget-get widget :value))
	(args (widget-get widget :args))
	(explicit (widget-get widget :explicit-choice))
        current val inline-p fun)
    (if explicit
	(progn
	  ;; If the user specified the choice for this value,
	  ;; respect that choice.
	  (widget-put widget :children (list (widget-create-child-value
					      widget explicit value)))
	  (widget-put widget :choice explicit)
	  (widget-put widget :explicit-choice nil))
      (setq inline-p (widget-inline-p widget t))
      (while args
	(setq current (car args)
	      args (cdr args))
        (if inline-p
            (if (widget-get current :inline)
                (setq val value
                      fun :match-inline)
              (setq val (if (consp value)
                            (car value)
                          value)
                    fun :match))
          (setq val value
                fun :match))
        (when (widget-apply current fun val)
          (widget-put widget :children (list (widget-create-child-value
                                              widget current val)))
          (widget-put widget :choice current)
          (setq args nil
                current nil)))
      (when current
	(let ((void (widget-get widget :void)))
	  (widget-put widget :children (list (widget-create-child-and-convert
					      widget void :value value)))
	  (widget-put widget :choice void))))))