     (rdebug-setup-windows)))
 
 (defun rdebug-display-original-window-configuration ()
-  "Display the layout of windows prior to starting the ruby debugger."
+  "Display the layout of windows prior to starting the rdebug Ruby debugger."
   (interactive)
   (rdebug-set-window-configuration-state 'original)
   (message
    "Type `M-x rdebug-display-debugger-window-configuration RET' to restore."))
 
 (defun rdebug-display-debugger-window-configuration ()
-  "Display the corrent layout of windows of the ruby debugger."
+  "Display the current layout of windows of the rdebug Ruby debugger."
   (interactive)
   (rdebug-set-window-configuration-state 'debugger)
   (message
    "Type `M-x rdebug-display-original-window-configuration RET' to restore."))
 
 (defun rdebug-set-windows (&optional name)
-  "Sets window used in multi-window frame and issues
-rdebug-restore-windows if rdebug-many-windows is set"
+  "Rename the processor buffer to correspond to script name NAME.
+
+When `rdebug-many-windows' is non-nil, the initial debugger
+window layout is used."
   (interactive "sProgram name: ")
-  (when name (setq gud-target-name name)
-	(setq gud-comint-buffer (current-buffer)))
-  (when gud-last-frame (setq gud-last-last-frame gud-last-frame))
+  (when name
+    (setq gud-target-name name)
+    (setq gud-comint-buffer (current-buffer)))
+  (when gud-last-frame
+    (setq gud-last-last-frame gud-last-frame))
   (rename-buffer (format "*rdebug-cmd-%s*" gud-target-name))
   (when rdebug-many-windows
     (rdebug-setup-windows)))


;; Remember, all menu items are added in the reverse order!

;; TODO: This is a mix of commands that apply to dedicated buffers,
;; the source buffers and the debugger shell buffer. Things like
;; "delete breakpoint" can be in source and the breakpoints window,
;; but not in the others.

(defun rdebug-populate-debugger-menu (map)
  "Populate the Rdebug 'Debugger' menu."
  (let ((menu (make-sparse-keymap)))

  (dolist (buffer (buffer-list))
    (when (string-match "\\*rdebug-[a-z]+\\*" (buffer-name buffer))
      (let ((w (get-buffer-window buffer)))
        (when w
          (delete-window w)))
      (kill-buffer buffer))))
(ad-activate 'gud-reset)

