Function: eca-chat-deleted

eca-chat-deleted is a natively compiled function defined in eca-chat.el.

Signature

(eca-chat-deleted SESSION PARAMS)

Documentation

Handle chat deleted notification for SESSION with PARAMS.

Switches any window showing the deleted chat to a sibling chat before removing it (so a dedicated chat window keeps showing a chat), and marks it closed so the kill-buffer hook skips its own cleanup.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat-deleted (session params)
  "Handle chat deleted notification for SESSION with PARAMS.
Switches any window showing the deleted chat to a sibling chat
before removing it (so a dedicated chat window keeps showing a
chat), and marks it closed so the `kill-buffer' hook skips its
own cleanup."
  (let* ((chat-id (plist-get params :chatId))
         (chat-buffer (eca-get (eca--session-chats session) chat-id)))
    (when chat-buffer
      (when (buffer-live-p chat-buffer)
        (eca-chat--switch-windows-to-sibling session chat-buffer)
        (with-current-buffer chat-buffer
          (eca-chat--stream-flush)
          (setq-local eca-chat--closed t)))
      (setf (eca--session-chats session)
            (eca-dissoc (eca--session-chats session) chat-id))
      (eca-chat--invalidate-tab-line-cache session)
      (when (buffer-live-p chat-buffer)
        (kill-buffer chat-buffer))
      (eca-chat--notify-status-changed session))
    (with-demoted-errors "eca-chat-deleted-functions: %S"
      (run-hook-with-args 'eca-chat-deleted-functions session chat-id))))