Function: eca-chat--refine-context

eca-chat--refine-context is a natively compiled function defined in eca-chat.el.

Signature

(eca-chat--refine-context CONTEXT)

Documentation

Refine CONTEXT before sending in prompt.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--refine-context (context)
  "Refine CONTEXT before sending in prompt."
  (let* ((type (plist-get context :type))
         (refined (pcase type
                    ("cursor" (progn
                                ;; Last resort when the idle tracker did
                                ;; not populate the position yet.
                                (unless eca-chat--cursor-context
                                  (eca-chat--track-cursor))
                                (-> context
                                    (plist-put :path (plist-get eca-chat--cursor-context :path))
                                    (plist-put :position (plist-get eca-chat--cursor-context :position)))))
                    (_ context)))
         (path (plist-get refined :path)))
    (if path
        (plist-put (copy-sequence refined) :path (eca--path-local-to-remote path))
      refined)))