Function: claude-code-ide-toggle-recent

claude-code-ide-toggle-recent is an interactive and natively compiled function defined in claude-code-ide.el.

Signature

(claude-code-ide-toggle-recent)

Documentation

Toggle visibility of all Claude Code windows in the current tab.

If any Claude window is visible, hide all of them and remember the set. If none is visible, restore the remembered set, falling back to the most recently accessed instance. Tab-bar tabs keep independent window layouts, so each tab hides and restores its own set.

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-toggle-recent ()
  "Toggle visibility of all Claude Code windows in the current tab.
If any Claude window is visible, hide all of them and remember the
set.  If none is visible, restore the remembered set, falling back to
the most recently accessed instance.  Tab-bar tabs keep independent
window layouts, so each tab hides and restores its own set."
  (interactive)
  (let ((visible (cl-remove-if-not #'claude-code-ide--session-visible-p
                                   (claude-code-ide-mcp--active-sessions))))
    (cond
     ;; Close all visible windows, remembering the set
     (visible
      (claude-code-ide--hidden-panel-set :all visible)
      (dolist (session visible)
        (claude-code-ide--toggle-existing-window session))
      (message "Closed all Claude Code windows%s"
               (if (and (fboundp 'tab-bar-tabs)
                        (cdr (tab-bar-tabs)))
                   " in this tab" "")))

     ;; Restore the remembered set (skipping stopped instances)
     ((cl-remove-if #'claude-code-ide-mcp-session-cleanup-done
                    (claude-code-ide--hidden-panel-get :all))
      (let ((restore (cl-remove-if #'claude-code-ide-mcp-session-cleanup-done
                                   (claude-code-ide--hidden-panel-get :all))))
        (claude-code-ide--hidden-panel-set :all nil)
        (dolist (session restore)
          (claude-code-ide--display-buffer-in-side-window
           (claude-code-ide-mcp-session-buffer session)))
        (message "Restored %d Claude Code window%s"
                 (length restore) (if (cdr restore) "s" ""))))

     ;; No remembered set, show the most recent one
     ((and claude-code-ide--last-accessed-buffer
           (buffer-live-p claude-code-ide--last-accessed-buffer))
      (claude-code-ide--display-buffer-in-side-window claude-code-ide--last-accessed-buffer)
      (message "Opened most recent Claude Code session"))

     ;; No recent session available
     (t
      (user-error "No recent Claude Code session to toggle")))))