Function: combobulate-procedure--filter-marked-nodes

combobulate-procedure--filter-marked-nodes is a natively compiled function defined in combobulate-procedure.el.

Signature

(combobulate-procedure--filter-marked-nodes NODES &optional KEEP-MATCH KEEP-DISCARD KEEP-MARK)

Documentation

Filter NODES based on their marks.

MATCH-TYPES and DISCARD-TYPES are lists of node types to match or discard, respectively.

If keep-mark is non-nil, keep the mark in the result.

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-procedure.el
(defun combobulate-procedure--filter-marked-nodes (nodes &optional keep-match keep-discard keep-mark)
  "Filter NODES based on their marks.

MATCH-TYPES and DISCARD-TYPES are lists of node types to match or
discard, respectively.

If keep-mark is non-nil, keep the mark in the result."
  (let ((result))
    (pcase-dolist (`(,mark . ,node) nodes)
      (cond
       ((or (and (eq mark '@match) keep-match)
            (and (eq mark '@discard) keep-discard))
        (push (if keep-mark (cons mark node) node) result))
       ;; deal with tree-sitter-named nodes
       ((eq mark 'discard)
        (push (if keep-mark (cons '@discard node) node) result))
       ((eq mark 'match)
        (push (if keep-mark (cons '@match node) node) result))))
    (nreverse result)))