Function: eca-chat-inline--discard-failed-chat

eca-chat-inline--discard-failed-chat is a natively compiled function defined in eca-chat-inline.el.

Signature

(eca-chat-inline--discard-failed-chat SESSION OV CREATED-BUFFER)

Documentation

Roll back state pre-created for OV's chat by a failed first prompt.

No-op unless CREATED-BUFFER is non-nil (the mirror buffer created by the failed request): deregisters it from SESSION and kills it, and clears the source buffer stickiness so the next prompt picks
(and re-forks) a chat again, since the server never created this
one.

Source Code

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

(defun eca-chat-inline--discard-failed-chat (session ov created-buffer)
  "Roll back state pre-created for OV's chat by a failed first prompt.
No-op unless CREATED-BUFFER is non-nil (the mirror buffer created
by the failed request): deregisters it from SESSION and kills it,
and clears the source buffer stickiness so the next prompt picks
\(and re-forks) a chat again, since the server never created this
one."
  (when created-buffer
    (let ((chat-id (overlay-get ov 'eca-chat-inline--chat-id)))
      (when (and (buffer-live-p created-buffer)
                 (eq created-buffer (eca-chat--get-chat-buffer session chat-id)))
        (setf (eca--session-chats session)
              (eca-dissoc (eca--session-chats session) chat-id))
        (eca-chat--invalidate-tab-line-cache session)
        (with-current-buffer created-buffer
          (setq-local eca-chat--closed t))
        (kill-buffer created-buffer)
        (eca-chat--notify-status-changed session))
      (when-let* ((src (overlay-get ov 'eca-chat-inline--source-buffer))
                  ((buffer-live-p src)))
        (with-current-buffer src
          (when (equal eca-chat-inline--chat-id chat-id)
            (setq-local eca-chat-inline--chat-id nil)))))))