Function: eca-chat-add-context-to-system-prompt
eca-chat-add-context-to-system-prompt is an interactive and natively
compiled function defined in eca-chat.el.
Signature
(eca-chat-add-context-to-system-prompt)
Documentation
Add context to system prompt in chat in a DWIM manner.
- If a region selected, add the file or the buffer content in
that lines range.
- If in Dired, add the marked files/dirs or current file/dir at point.
- If in Treemacs, add selected file/dir.
- Else add current file or the whole buffer content.
Key Bindings
This command is not in any keymaps.
Source Code
;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
;;;###autoload
(defun eca-chat-add-context-to-system-prompt ()
"Add context to system prompt in chat in a DWIM manner.
- If a region selected, add the file or the buffer content in
that lines range.
- If in Dired, add the marked files/dirs or current file/dir at point.
- If in Treemacs, add selected file/dir.
- Else add current file or the whole buffer content."
(interactive)
(eca-assert-session-running (eca-session))
(let* ((contexts (eca-chat--get-contexts-dwim)))
(unless contexts
(user-error "No context for this buffer; select a region to add its content"))
(eca-chat--with-current-buffer (eca-chat--get-last-buffer (eca-session))
(seq-doseq (context contexts)
(eca-chat--add-context context)))))