Skip to content

Sending from your code

These commands run from the buffer you are editing. They send to the session of its project; when that is ambiguous, ecc asks once and remembers the answer for the buffer. A prompt sent while a turn runs waits in the queue.

In the menu (C-c c ?):

Key Sends
s A line typed in the minibuffer (C-u s asks for the session)
x A line, with the current file and line
g The region, or the whole buffer, in a quoted block (C-u g asks for an instruction to put before it)
f @ and the file’s path, for the CLI to read; offers to save the buffer first

x and g add the code in a block like this:

---
Current context: hello.py L1-L3
```python
def greet(name):
return "hello " + name
```

e sends the diagnostics on the current line with the code around it, from Flymake, then Flycheck, then any help text at point.

l asks about the region or the file and shows the answer in an overlay above point, not in the transcript. n and p scroll it, r asks a follow-up, and q closes it. The question runs in a lightweight or a forked session, chosen once for each buffer.

w rewrites the region by an instruction. The replacement is shown in place, and RET writes it into the buffer. It runs without tools: the CLI returns the code and Emacs changes the buffer.

In the prompt region, @ points at code. The first three are words you type as they are; the last two are @ followed by a file’s path:

Reference Sends
@region The active region, as a quoted code block
@cursor The line at point, with the lines around it
@diagnostics The Flymake or Flycheck diagnostics of the buffer
@ and a file with lines, as in @src/reader.py:10-40 Those lines of the file
@ and a file, as in @src/reader.py The path, for the CLI to read

Emacs expands the first four before sending: the reference becomes a short label, and the content goes in a quoted block under the prompt. @region, @cursor and @diagnostics read the buffer you were editing before you went to the session. The echo area says what was attached, and warns when @region had no region.

A file given by path alone is read by the CLI, and the transcript shows nothing for it.

TAB after @ offers the three words and the project’s files. A path that starts with /, ~/, ./ or ../ completes from anywhere, one directory at a time, as in find-file. A relative path is relative to the session’s project. Remote (TRAMP) paths are not completed: the CLI cannot read them.

C-c C-x in the session buffer turns on editor context: each prompt then carries the current file and line.