Function: eca-chat-compose
eca-chat-compose is an interactive and natively compiled function
defined in eca-chat-compose.el.
Signature
(eca-chat-compose)
Documentation
Compose a prompt for the current chat in a dedicated buffer.
When called from a chat buffer the prompt targets that chat,
otherwise it targets the session's last used chat.
C-c C-c (eca-chat-compose-send) sends the buffer content as a prompt to that chat;
C-c C-k (eca-chat-compose-cancel) discards it.
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-compose.el
;;;###autoload
(defun eca-chat-compose ()
"Compose a prompt for the current chat in a dedicated buffer.
When called from a chat buffer the prompt targets that chat,
otherwise it targets the session's last used chat.
\\<eca-chat-compose-mode-map>\\[eca-chat-compose-send] sends the \
buffer content as a prompt to that chat;
\\[eca-chat-compose-cancel] discards it."
(interactive)
(let ((session (eca-session)))
(eca-assert-session-running session)
(let ((target (if (derived-mode-p 'eca-chat-mode)
(current-buffer)
(eca-chat--get-last-buffer session))))
(unless (buffer-live-p target)
(user-error "No chat buffer found to compose for"))
(let ((buffer (generate-new-buffer
(format "*eca-compose:%s*" (buffer-name target)))))
(with-current-buffer buffer
(eca-chat-compose-mode)
(setq eca-chat-compose--target-buffer target)
;; Make `eca-session' resolve to the target's session from
;; this buffer, so completion and the send path work
;; regardless of where the compose window ends up.
(setq-local eca--session-id-cache (eca--session-id session))
(when-let* ((dir (car (eca--session-workspace-folders session))))
(setq-local default-directory dir))
;; Carry the target's chat id so @/# completion queries
;; (chat/queryContext, chat/queryFiles) run against that chat.
(setq-local eca-chat--id (buffer-local-value 'eca-chat--id target)))
(pop-to-buffer buffer)))))