Function: eca-chat-inline--setup-overlay

eca-chat-inline--setup-overlay is a natively compiled function defined in eca-chat-inline.el.

Signature

(eca-chat-inline--setup-overlay SESSION START END)

Documentation

Create the inline overlay for SESSION between START and END.

START and END are clamped to the buffer limits: they can be stale when the buffer changed while the prompt minibuffer was open
(e.g. a tool call editing this file).

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat-inline.el
;;;; Overlay rendering

(defun eca-chat-inline--setup-overlay (session start end)
  "Create the inline overlay for SESSION between START and END.
START and END are clamped to the buffer limits: they can be stale
when the buffer changed while the prompt minibuffer was open
\(e.g. a tool call editing this file)."
  (let* ((start (max (point-min) (min start (point-max))))
         (end (min (max start end) (point-max)))
         (ov (make-overlay start end nil t)))
    (overlay-put ov 'category 'eca-chat-inline)
    ;; Evaporating a zero-width overlay (empty buffer) would delete
    ;; it right away, so only evaporate real anchors.
    (when (< start end)
      (overlay-put ov 'evaporate t))
    (overlay-put ov 'eca-chat-inline--chat-id nil)
    (overlay-put ov 'eca-chat-inline--session-id (eca--session-id session))
    (overlay-put ov 'eca-chat-inline--source-buffer (current-buffer))
    (overlay-put ov 'eca-chat-inline--text-acc "")
    (overlay-put ov 'eca-chat-inline--status "Sending prompt...")
    (overlay-put ov 'eca-chat-inline--state 'running)
    (overlay-put ov 'eca-chat-inline--pending-tools '())
    (overlay-put ov 'eca-chat-inline--pending-summaries '())
    (overlay-put ov 'eca-chat-inline--temp-buffer
                 (generate-new-buffer " *eca-chat-inline*"))
    (overlay-put ov 'face 'eca-chat-inline-anchor-face)
    ;; Just below eca-rewrite's 2000 so a rewrite over the same text
    ;; (which replaces its display) deterministically wins.
    (overlay-put ov 'priority 1999)
    (overlay-put ov 'keymap eca-chat-inline-actions-map)
    (overlay-put ov 'help-echo "ECA inline prompt")
    (add-hook 'kill-buffer-hook
              #'eca-chat-inline--on-source-buffer-killed nil t)
    (eca-chat-inline--viewport-mode 1)
    (eca-chat-inline--refresh ov)
    ov))