Function: eca-chat-add-filepath-to-user-prompt
eca-chat-add-filepath-to-user-prompt is an interactive and natively
compiled function defined in eca-chat.el.
Signature
(eca-chat-add-filepath-to-user-prompt &optional ARG)
Documentation
Add filepath to user prompt in chat in a DWIM manner.
- If a region selected, add filepath with lines range selected.
- If in Dired, add the marked files/dirs / current file/dir paths at point.
- If in Treemacs, add selected file/dir path.
- Else add current filepath.
With prefix ARG, add the filepath without selecting the chat window, leaving point where it was.
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-filepath-to-user-prompt (&optional arg)
"Add filepath to user prompt in chat in a DWIM manner.
- If a region selected, add filepath with lines range selected.
- If in Dired, add the marked files/dirs / current file/dir paths at point.
- If in Treemacs, add selected file/dir path.
- Else add current filepath.
With prefix ARG, add the filepath without selecting the chat
window, leaving point where it was."
(interactive "P")
(eca-assert-session-running (eca-session))
(let* ((contexts (eca-chat--get-contexts-dwim)))
(eca-chat--with-current-buffer (eca-chat--get-last-buffer (eca-session))
(seq-doseq (context contexts)
(when-let ((path (plist-get context :path)))
(eca-chat--insert-prompt (concat (eca-chat--filepath->str path (plist-get context :linesRange))
" "))))
(unless arg
(eca-chat--select-window)
(goto-char (line-end-position))))))