Skip to content

Add eca-chat-compose to compose prompts in a dedicated buffer - #299

Merged
ericdallo merged 2 commits into
editor-code-assistant:masterfrom
ovistoica:feat/chat-compose
Aug 24, 2026
Merged

Add eca-chat-compose to compose prompts in a dedicated buffer#299
ericdallo merged 2 commits into
editor-code-assistant:masterfrom
ovistoica:feat/chat-compose

Conversation

@ovistoica

@ovistoica ovistoica commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds eca-chat-compose: a markdown compose buffer for drafting a chat prompt outside the inline prompt field, handy for long or multi-line prompts. This ports the multi-eca-compose feature from my multi-eca dashboard package to core eca, wired into the transient menu so it's reachable directly from a chat buffer, not just from that external dashboard.

  • M-x eca-chat-compose opens a dedicated buffer targeting the chat under point (or the session's last chat when called elsewhere).
  • C-c C-c (eca-chat-compose-send) sends the buffer content to the target chat through the same eca-chat--send-prompt path used by the inline prompt (contexts, history, model/agent/variant/trust are all respected).
  • C-c C-k (eca-chat-compose-cancel) discards it.
  • @context / #filepath mentions complete against the server via TAB, reusing eca-chat-completion-at-point.
  • Yanking a clipboard image saves it to a temp file and inserts an @file mention, mirroring the chat buffer's paste behavior.
  • Added to the transient menu (i under "Chat").

Two small supporting changes:

  • eca-chat--point-at-new-context-p now returns nil instead of a false positive when there's no context-area overlay in the buffer (previously line-number-at-pos's nil fallback made this predicate true at any end-of-line). This lets the compose buffer share completion machinery without any advice/hack to suppress false positives.
  • Extracted eca-chat-media--save-clipboard-image out of eca-chat--yank-image-handler so the temp-file-writing logic (and its error handling) is shared between the chat and compose clipboard-paste handlers instead of duplicated.

Demo

screenrecording-2026-08-24_10-29-44-720p

Test plan

  • test/eca-chat-compose-test.el (buttercup): targeting the current chat vs. the session's last chat, empty-prompt and dead-target user-errors, send delivers the prompt text via eca-chat--send-prompt and kills the buffer, cancel discards without sending.
  • Full existing buttercup suite (506 specs) still passes after the eca-chat--point-at-new-context-p and yank-handler refactors.
  • Byte-compiles clean (batch-byte-compile) with no new warnings.
  • Dogfooded locally via use-package :vc pointed at this branch.

New markdown buffer to draft a prompt for the chat under point (or
the session's last chat) instead of the inline prompt field, handy
for long or multi-line prompts. C-c C-c sends the buffer content to
the chat through the same eca-chat--send-prompt path as the inline
prompt, C-c C-k discards it. @context/#filepath mentions complete
against the server and clipboard images are yanked as @file
mentions, mirroring the chat buffer. Wired into the transient menu
(i).

eca-chat--point-at-new-context-p now returns nil instead of a false
positive when there is no context-area overlay, so compose buffers
need no special-casing to use the shared completion path. Clipboard
image saving is shared between the chat and compose yank handlers
via the new eca-chat-media--save-clipboard-image.
@ericdallo
ericdallo merged commit 04ed718 into editor-code-assistant:master Aug 24, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants