Function: combobulate-tally-nodes

combobulate-tally-nodes is a natively compiled function defined in combobulate-manipulation.el.

Signature

(combobulate-tally-nodes NODES &optional SKIP-LABEL)

Documentation

Groups NODES into labels (if any) and their types and tallies them.

If NODES is a list of (@label . node) cons cells, tally nodes by that first; followed by the node type of each grouped label.

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-manipulation.el
(defun combobulate-tally-nodes (nodes &optional skip-label)
  "Groups NODES into labels (if any) and their types and tallies them.

If NODES is a list of `(@label . node)' cons cells, tally nodes by that
first; followed by the node type of each grouped label."
  (if nodes
      (if (and (consp nodes) (consp (car nodes)))
          (mapconcat
           (pcase-lambda (`(,label . ,rest))
             (let ((string-label (symbol-name label)))
               (concat (if skip-label "" (concat (capitalize (string-trim-left string-label "@")) " "))
                       (combobulate-tally-nodes (mapcar 'cdr rest)))))
           (combobulate-group-nodes nodes #'car) ". ")
        (string-join (mapcar (lambda (group)
                               (format
                                "%s `%s'"
                                (propertize (int-to-string (length (cdr group))) 'face 'bold)
                                (propertize (car group) 'face 'combobulate-active-indicator-face)))
                             (combobulate-group-nodes nodes #'combobulate-pretty-print-node-type))
                     "; "))
    "zero"))