Function: combobulate-procedure-start

combobulate-procedure-start is a natively compiled function defined in combobulate-procedure.el.

Signature

(combobulate-procedure-start PT-OR-NODE &optional PROCEDURES EXHAUSTIVE)

Documentation

Attempt to find a procedure at PT-OR-NODE.

If PROCEDURES is not given, use combobulate-default-procedures. If EXHAUSTIVE is non-nil, then collect all possible procedures that may apply.

This function returns a list of combobulate-procedure-result objects.

See combobulate-procedure-apply for instructions on how to write PROCEDURES.

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-procedure.el
(defun combobulate-procedure-start (pt-or-node &optional procedures exhaustive)
  "Attempt to find a procedure at PT-OR-NODE.

If PROCEDURES is not given, use `combobulate-default-procedures'.
If EXHAUSTIVE is non-nil, then collect all possible procedures
that may apply.

This function returns a list of `combobulate-procedure-result'
objects.

See `combobulate-procedure-apply' for instructions on how to write
PROCEDURES."
  (let ((matches)
        (nodes
         (seq-uniq
          (append
           ;; start by getting all the nodes *at* point:
           ;; meaning, nodes beginning at point. They should
           ;; be our first port of call in terms of matching,
           ;; as they are the most specific.
           (save-excursion
             (goto-char (if (numberp pt-or-node)
                            pt-or-node
                          (combobulate-node-start pt-or-node)))
             (cons (if (combobulate-node-p pt-or-node)
                       pt-or-node
                     (combobulate-node-at-point))
                   (combobulate-all-nodes-at-point)))
           ;; then, get all the nodes point is at.
           (combobulate-get-parents (combobulate-node-at-point))))))
    (catch 'done
      (dolist (procedure
               (or procedures
                   ;; if we haven't been given any procedures, use the default
                   ;; procedures.
                   combobulate-default-procedures
                   (error "No procedures given and no default procedures found")))
        (dolist (node nodes)
          (when-let (procedure-result
                     (combobulate-procedure-try
                      procedure
                      node))
            (push procedure-result matches)
            (unless exhaustive (throw 'done procedure-result))))))
    (when combobulate-debug (message "Matches: %s" matches))
    matches))