Function: toolbarx-process-symbol

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

Signature

(toolbarx-process-symbol SYMBOL MEANING-ALIST PROPS SWITCHES)

Documentation

Process a button given by SYMBOL in MEANING-ALIST.

The processed button is appended in SWITCHES, which is returned. Look for a association of SYMBOL in MEANING-ALIST for collecting properties. Such association is a list that represents either a normal button (a description of the button) or an alias group (the symbol is an alias for a group of buttons). PROPS is a externel list of properties that are merged and then applied to the button. Scope is given by GLOBAL-FLAG.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/toolbar-x.el
(defun toolbarx-process-symbol (symbol meaning-alist props switches)
  "Process a button given by SYMBOL in MEANING-ALIST.
The processed button is appended in SWITCHES, which is returned.
Look for a association of SYMBOL in MEANING-ALIST for collecting
properties.  Such association is a list that represents either a
normal button (a description of the button) or an alias
group (the symbol is an alias for a group of buttons).  PROPS is
a externel list of properties that are merged and then applied to
the button.  Scope is given by GLOBAL-FLAG."
  ;; there are 3 situations: symbol is :new-line, there is an alias group
  ;; or a normal button
  (let ((button-assq (cdr (assq symbol meaning-alist))))
    (cond
     ((eq (car button-assq) :alias)
      ;; button association is ALIAS GROUP is passed to
      ;; `toolbarx-process-group' as is but without the car.
      ;; return: (toolbarx-process-group... returns updates switch
      (toolbarx-process-group (cdr button-assq) meaning-alist props switches))
     (t
      ;; NORMAL BUTTON (association is a list of properties)
      ;;
      ;; properties need to be processed, that is, merge internal
      ;; and external (given by PROPS) properties
      (let* (;; button properties defined in `toolbarx-button-props'
             (props-override    (nth 2 toolbarx-button-props))
             (props-add         (nth 3 toolbarx-button-props))
             ;; split considering also dropdown-group properties
             (button-assq-split
              (toolbarx-separate-options
               button-assq
               (append (nth 1 toolbarx-button-props)
                       (nth 1 toolbarx-dropdown-props))))
             (button-split-no-props (car button-assq-split))
             (button-split-props (cdr button-assq-split))
             ;; if there is no :image or :command in the props,
             ;; try to get them from no-props part
             (button-image-no-prop
              (unless (memq :image button-split-props)
                (when (> (length button-split-no-props) 0)
                  (list :image (nth 0 button-split-no-props)))))
             (button-command-no-prop
              (unless (memq :command button-split-props)
                (when (> (length button-split-no-props) 1)
                  (list :command (nth 1 button-split-no-props)))))
             (button-props (append button-split-props
                                   button-image-no-prop
                                   button-command-no-prop))
             ;; merge props
             (merged-props (toolbarx-merge-props button-props props
                                                 props-override
                                                 props-add)))
        ;; return:
        (nreverse (cons (cons symbol merged-props) (nreverse switches))))))))