Function: toolbarx-good-option-list-p

toolbarx-good-option-list-p is a byte-compiled function defined in toolbar-x.el.

Signature

(toolbarx-good-option-list-p OPTION-LIST VALID-OPTIONS)

Documentation

Non-nil means the OPTION-LIST is of form (OPT FORM ... OPT FORM).

Each OPT is member of VALID-OPTIONS and OPT are pairwise different. OPTION-LIST equal to nil is a good option list.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/toolbar-x.el
(defun toolbarx-good-option-list-p (option-list valid-options)
  "Non-nil means the OPTION-LIST is of form (OPT FORM ... OPT FORM).
Each OPT is member of VALID-OPTIONS and OPT are pairwise
different.  OPTION-LIST equal to nil is a good option list."
  (let ((elt-in-valid t)
        (temp-opt-list option-list)
        (list-diff)
        (n (/ (length option-list) 2)))
    (dotimes (i n)
      (when (> i 0)
        (setq temp-opt-list (cddr temp-opt-list)))
      (cl-pushnew (car temp-opt-list) list-diff :test #'equal)
      (setq elt-in-valid (and elt-in-valid
                              (memq (car temp-opt-list)
                                    valid-options))))
    (and elt-in-valid                   ; options are on VALID-OPTOPNS
         ;; OPTION-LIST has all option different from each other
         (eq (length list-diff) n)
         ;; OPTION-LIST has even number of elements
         (eq (% (length option-list) 2) 0))))