Function: claude-code-ide--toggle-existing-window

claude-code-ide--toggle-existing-window is a natively compiled function defined in claude-code-ide.el.

Signature

(claude-code-ide--toggle-existing-window SESSION)

Documentation

Toggle visibility of SESSION's terminal window.

If the window is visible, it will be hidden. If the window is not visible, it will be shown in a side window.

Source Code

;; Defined in /nix/store/yjvbhwl7p6zrbw9xlnni7y4hra8sa3pl-emacs-packages-deps/share/emacs/site-lisp/claude-code-ide.el
;;; Commands

(defun claude-code-ide--toggle-existing-window (session)
  "Toggle visibility of SESSION's terminal window.
If the window is visible, it will be hidden.
If the window is not visible, it will be shown in a side window."
  (let* ((buffer (claude-code-ide-mcp-session-buffer session))
         (window (and buffer (get-buffer-window buffer))))
    (if window
        ;; Window is visible, hide it
        (progn
          ;; Track this instance as last accessed when closing
          (claude-code-ide--touch-session session)
          (delete-window window)
          (claude-code-ide-debug "Claude Code window hidden"))
      ;; Window is not visible, show it
      (progn
        (claude-code-ide--display-buffer-in-side-window buffer)
        ;; Update the original tab when showing the window
        (when (fboundp 'tab-bar--current-tab)
          (setf (claude-code-ide-mcp-session-original-tab session) (tab-bar--current-tab)))
        (claude-code-ide-debug "Claude Code window shown")))))