Function: eca-chat-inline-prompt

eca-chat-inline-prompt is an interactive and natively compiled function defined in eca-chat-inline.el.

Signature

(eca-chat-inline-prompt &optional FORCE-SELECT)

Documentation

Ask ECA a question, streaming the answer into an overlay at point.

When the buffer has no inline chat yet, asks which chat to use: an existing chat has its history forked server-side into the inline chat (keeping the original clean) while New chat starts fresh. The chat becomes sticky for the buffer so later invocations reuse it directly; with a prefix argument FORCE-SELECT the selection is always asked again. With an active region, it is sent as context and used as the overlay anchor. On an existing overlay this sends a reply to the same chat.

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-inline.el
;;;###autoload
(defun eca-chat-inline-prompt (&optional force-select)
  "Ask ECA a question, streaming the answer into an overlay at point.
When the buffer has no inline chat yet, asks which chat to use:
an existing chat has its history forked server-side into the
inline chat (keeping the original clean) while `New chat' starts
fresh.  The chat becomes sticky for the buffer so later
invocations reuse it directly; with a prefix argument
FORCE-SELECT the selection is always asked again.  With an active
region, it is sent as context and used as the overlay anchor.  On
an existing overlay this sends a reply to the same chat."
  (interactive "P")
  (let ((session (eca-chat-inline--session)))
    (when eca-chat-inline--overlays-hidden
      (eca-chat-inline--set-overlays-hidden nil))
    (cond
     (force-select
      (when-let* ((existing-ov (eca-chat-inline--overlay-at-point)))
        (eca-chat-inline--delete-overlay existing-ov))
      (setq-local eca-chat-inline--chat-id nil)
      (eca-chat-inline--prompt-selecting session))
     ((eca-chat-inline--overlay-at-point)
      (eca-chat-inline--reply session (eca-chat-inline--overlay-at-point)))
     (t
      (let ((sticky-buffer (and eca-chat-inline--chat-id
                                (eca-chat-inline--ensure-chat-buffer
                                 session eca-chat-inline--chat-id))))
        (if sticky-buffer
            (progn
              (eca-chat-inline--assert-idle sticky-buffer)
              (eca-chat-inline--start-prompt
               session
               (buffer-local-value 'eca-chat--id sticky-buffer)
               nil
               (eca-chat-inline--chat-desc sticky-buffer)))
          (setq-local eca-chat-inline--chat-id nil)
          (eca-chat-inline--prompt-selecting session)))))))