Function: claude-code-ide-switch-to-buffer

claude-code-ide-switch-to-buffer is an interactive and natively compiled function defined in claude-code-ide.el.

Signature

(claude-code-ide-switch-to-buffer)

Documentation

Switch to a Claude Code buffer of the current project.

With several instances the most recently used one is chosen (a prefix argument picks explicitly). The window is always focused: explicit navigation overrides claude-code-ide-focus-on-open.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/yjvbhwl7p6zrbw9xlnni7y4hra8sa3pl-emacs-packages-deps/share/emacs/site-lisp/claude-code-ide.el
;;;###autoload
(defun claude-code-ide-switch-to-buffer ()
  "Switch to a Claude Code buffer of the current project.
With several instances the most recently used one is chosen (a prefix
argument picks explicitly).  The window is always focused: explicit
navigation overrides `claude-code-ide-focus-on-open'."
  (interactive)
  (let ((session (claude-code-ide--resolve-session 'auto "Switch to Claude instance: ")))
    (unless session
      (user-error "No Claude Code session for this project.  Use M-x claude-code-ide to start one"))
    (let ((buffer (claude-code-ide-mcp-session-buffer session)))
      (if-let* ((window (and buffer (get-buffer-window buffer))))
          ;; Buffer is visible, just focus it
          (select-window window)
        ;; Buffer exists but not visible, display it and focus it
        (when-let* ((window (claude-code-ide--display-buffer-in-side-window buffer)))
          (select-window window))))))