Function: combobulate-envelope-get-applicable-nodes

combobulate-envelope-get-applicable-nodes is a natively compiled function defined in combobulate-envelope.el.

Signature

(combobulate-envelope-get-applicable-nodes ENVELOPE &optional FORCE)

Documentation

Given an ENVELOPE, return a list of valid nodes to apply it to.

The NODES are the nodes that the envelope can be applied to. The NODES must be a list of strings or procedures. If a string, it is the name of a node type. If a procedure, then it follows the procedural rules laid out in combobulate-procedure-apply.

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-envelope.el
(defun combobulate-envelope-get-applicable-nodes (envelope &optional _force)
  "Given an ENVELOPE, return a list of valid nodes to apply it to.

The NODES are the nodes that the envelope can be applied to. The
NODES must be a list of strings or procedures. If a string, it is
the name of a node type. If a procedure, then it follows the
procedural rules laid out in `combobulate-procedure-apply'."
  (map-let (:nodes :shorthand) envelope
    ;; only nodes or shorthand can be used in the same envelope, never both.
    (if (and nodes shorthand)
        (error "Envelope `%s' has both `:nodes' and `:shorthand' defined. \
Only one can be used." envelope))
    (let* ((string-elements (seq-filter #'stringp nodes))
           (procedure-elements
            (append (seq-filter #'listp nodes)
                    (and shorthand (combobulate-envelope-get-shorthand-procedure shorthand)))))
      (seq-sort #'combobulate-node-after-node-p
                (mapcar #'combobulate-procedure-result-action-node
                        (append
                         (and procedure-elements (combobulate-procedure-start (point) procedure-elements t))
                         ;; As we have no selectors nor a parent discriminator, we just use the action node.
                         (combobulate-procedure-start (point) `((:activation-nodes ((:nodes ,string-elements)))) t)))))))