Function: eca-chat--switch-windows-to-sibling

eca-chat--switch-windows-to-sibling is a natively compiled function defined in eca-chat.el.

Signature

(eca-chat--switch-windows-to-sibling SESSION BUFFER)

Documentation

Switch any window showing BUFFER to a sibling chat of SESSION.

Updates the session last-chat-buffer and preserves each window's dedication flag so the dedicated chat window keeps showing a chat instead of falling back to an unrelated buffer. Returns the sibling buffer switched to, or nil when SESSION has no other chat.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--switch-windows-to-sibling (session buffer)
  "Switch any window showing BUFFER to a sibling chat of SESSION.
Updates the session `last-chat-buffer' and preserves each window's
dedication flag so the dedicated chat window keeps showing a chat
instead of falling back to an unrelated buffer.  Returns the
sibling buffer switched to, or nil when SESSION has no other chat."
  (when-let* ((other (eca-chat--sibling-chat-buffer session buffer)))
    (setf (eca--session-last-chat-buffer session) other)
    (dolist (win (get-buffer-window-list buffer nil t))
      (let ((dedicated (window-dedicated-p win)))
        (set-window-dedicated-p win nil)
        (set-window-buffer win other)
        (set-window-dedicated-p win dedicated)))
    other))