Function: eca-chat--extract-contexts-from-prompt

eca-chat--extract-contexts-from-prompt is a natively compiled function defined in eca-chat.el.

Signature

(eca-chat--extract-contexts-from-prompt)

Documentation

Extract contexts from prompt text properties.

Resteps a list of context plists found in the prompt field, plus raw @path tokens that resolve to existing files or directories under a workspace root (e.g. after drilling into a directory without finalizing it).

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--extract-contexts-from-prompt ()
  "Extract contexts from prompt text properties.
Resteps a list of context plists found in the prompt field, plus
raw @path tokens that resolve to existing files or directories
under a workspace root (e.g. after drilling into a directory
without finalizing it)."
  (when-let ((prompt-start (eca-chat--prompt-field-start-point)))
    (let ((contexts '())
          (pos prompt-start)
          (end (point-max)))
      (while (< pos end)
        (when-let ((context (get-text-property pos 'eca-chat-context-item)))
          (unless (member context contexts)
            (push context contexts)))
        (setq pos (next-single-property-change pos 'eca-chat-context-item nil end)))
      (append (nreverse contexts)
              (eca-chat--raw-prompt-contexts)))))