     (unless dont-restore
       ;; Switch to the saved state,
       (cond
-       ((eq state 'debugger)
+       ((not (eq state 'original))
         (if rdebug-debugger-window-configuration
             (set-window-configuration rdebug-debugger-window-configuration)))
        ((eq state 'original)

                        state rdebug-window-configuration-state)
  (when (not (eq state rdebug-window-configuration-state))
    ;; Save the previous state.
    (cond ((eq rdebug-window-configuration-state 'debugger)
           (setq rdebug-debugger-window-configuration
                 (current-window-configuration)))
          ((eq rdebug-window-configuration-state 'original)



(defun rdebug--setup-secondary-window-help-buffer (buf comint-buffer)
  (rdebug-debug-enter "rdebug--setup-secondary-window-help-buffer"
    (with-current-buffer buf
      (rdebug-secondary-window-help-mode)
      (set (make-local-variable 'gud-comint-buffer) comint-buffer)
