Function: toolbarx-process-group

toolbarx-process-group is a byte-compiled function defined in toolbar-x.el.

Signature

(toolbarx-process-group GROUP MEANING-ALIST PROPS SWITCHES)

Documentation

Return an updated version of SWITCHES.

Append to already processed buttons (stored in SWITCHES) a processed version of GROUP. Groups are useful to distribute properties. External properties are given in PROPS, and merged with the internal properties that are in the end of GROUP. If properties (after merge) contain a :insert property, return a list where the first and second elements are :insert and its value, and after that a list in the same format as SWITCHES.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/toolbar-x.el
(defun toolbarx-process-group (group meaning-alist props switches)
  "Return an updated version of SWITCHES.
Append to already processed buttons (stored in SWITCHES) a
processed version of GROUP.  Groups are useful to distribute
properties.  External properties are given in PROPS, and merged
with the internal properties that are in the end of GROUP.  If
properties (after merge) contain a `:insert' property, return a
list where the first and second elements are `:insert' and its
value, and after that a list in the same format as SWITCHES."
  (cond
   ;; if DROPDOWN group
   ((eq (car group) :dropdown-group)
    (toolbarx-process-dropdown-group group meaning-alist props switches))
   ;; if EVAL group
   ((eq (car group) :eval-group)
    (let ((current-switches switches))
      (dolist (elt (cdr group) current-switches)
        (let ((eval-elt (eval elt t)))
          (setq current-switches
                (toolbarx-process-group (if (listp eval-elt)
                                            eval-elt
                                          (list eval-elt))
                                        meaning-alist props
                                        current-switches))))))
   ;; if normal group
   (t
    (let* ((splited-props
            (toolbarx-separate-options
             group (append (nth 1 toolbarx-button-props)
                           (nth 1 toolbarx-dropdown-props))))
           (intern-props (cdr splited-props))
           (group-without-props (car splited-props))
           (merged-props
            (toolbarx-merge-props intern-props props
                                  (append (nth 2 toolbarx-button-props)
                                          (nth 2 toolbarx-dropdown-props))
                                  (append (nth 3 toolbarx-button-props)
                                          (nth 3 toolbarx-dropdown-props)))))
      ;; check whether merged props have an `:insert'
      (if (memq :insert merged-props)
          ;; if yes, prepend switches with a (:insert cond elements)
          (let* ((memq-ins (memq :insert merged-props))
                 (ins-val (if (and (listp (cadr memq-ins))
                                   (eq :add-value-list
                                       (car (cadr memq-ins))))
                              ;; if property is add-value property
                              (let* ((p (assq
                                         :insert
                                         (nth 0 toolbarx-button-props)))
                                     (add-list (list (cddr p)))
                                     (prop-good-val))
                                (dolist (val (cdr (cadr memq-ins)))
                                  (setq prop-good-val (funcall (cadr p) val))
                                  (when (car prop-good-val)
                                    (setq add-list (cons (cdr prop-good-val)
                                                         add-list))))
                                ;; return: (nreverse add-list)
                                (setq add-list (nreverse add-list))
                                (if (eq 2 (length add-list))
                                    (cadr add-list) ; just 1 value, no
                                  add-list))        ; add-function
                            ;; if property is not add-value
                            (cadr memq-ins)))
                 (merged-props-without-insert
                  (append (butlast merged-props (length memq-ins))
                          (cddr memq-ins)))
                 (group-switches
                  (toolbarx-process-group-without-insert
                   group-without-props merged-props-without-insert
                   meaning-alist nil)))
            ;; return
            (nreverse (cons (append (list :insert ins-val)
                                    group-switches)
                            (nreverse switches))))
        ;; if not, just append what is processed to switches
        (toolbarx-process-group-without-insert group-without-props
                                               merged-props meaning-alist
                                               switches))))))