 (defvar rdebug-breakpoints-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mouse-2] 'rdebug-goto-breakpoint-mouse)
-    (define-key map " " 'rdebug-toggle-breakpoint)
-    (define-key map [? ] 'rdebug-toggle-breakpoint)
+    (define-key map [mouse-3] 'rdebug-goto-breakpoint-mouse)
+    (define-key map "t" 'rdebug-toggle-breakpoint)
     (define-key map [(control m)] 'rdebug-goto-breakpoint)
     (define-key map [?d] 'rdebug-delete-breakpoint)
     (rdebug-populate-secondary-buffer-map map)
+
+    ;; --------------------
+    ;; The "Breakpoints window" submeny.
+    (let ((submenu (make-sparse-keymap)))
+      (define-key-after map [menu-bar debugger breakpoints]
+        (cons "Breakpoints window" submenu)
+        'placeholder))
+
+    (define-key map [menu-bar debugger breakpoints toggle]
+      '(menu-item "Toggle breakpoint" rdebug-toggle-breakpoint))
+
+    (define-key map [menu-bar debugger breakpoints goto]
+      '(menu-item "Goto breakpoint" rdebug-goto-breakpoint))
+
     (define-key map [menu-bar debugger breakpoints delete]
       '(menu-item "Delete breakpoint" rdebug-delete-breakpoint))
+
     map)
   "Keymap to navigate/set/enable rdebug breakpoints.")
 


(defvar rdebug-original-window-configuration nil
  "The window layout rdebug should restore when the debugger exits.")

;; This is used to ensure that the original frame configuration is
;; restored even when the user re-starts the debugger several times.

  (gud-call (format "p %s=%s" var value)))


;; -- watch (the "display" annotation)

(defvar rdebug-watch-mode-map
  (let ((map (make-sparse-keymap)))
    (suppress-keymap map)
    (define-key map "a" 'rdebug-watch-add)
    (define-key map "\C-d" 'rdebug-watch-delete)
    (define-key map "d" 'rdebug-watch-delete)
    (define-key map "e" 'rdebug-watch-edit)
    (define-key map "\r" 'rdebug-watch-edit)
    (rdebug-populate-secondary-buffer-map map)

    ;; --------------------
    ;; The "Watch window" submeny.
    (let ((submenu (make-sparse-keymap)))
      (define-key-after map [menu-bar debugger watch]
        (cons "Watch window" submenu)
        'placeholder))

    (define-key map [menu-bar debugger watch delete]
      '(menu-item "Delete" rdebug-watch-delete
                  :enable (eq major-mode 'rdebug-watch-mode)))
    (define-key map [menu-bar debugger watch goto]
      '(menu-item "Edit" rdebug-watch-edit
                  :enable (eq major-mode 'rdebug-watch-mode)))
    (define-key map [menu-bar debugger watch add]
      '(menu-item "Add" rdebug-watch-add))

    map))

(defun rdebug-watch-mode ()
  "Major mode for rdebug watch window.

\\{rdebug-watch-mode}"
  (interactive)
  (kill-all-local-variables)
  (setq major-mode 'rdebug-watch-mode)
  (setq mode-name "RDEBUG Watch")
  (setq buffer-read-only t)
  (set (make-local-variable 'rdebug-secondary-buffer) t)
  (use-local-map rdebug-watch-mode-map)
  (run-mode-hooks 'rdebug-watch-mode-hook))

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

(defun rdebug-watch-add (expr)
  (interactive "sRuby expression: ")
  (if (not (string= expr ""))
      (gud-call (format "display %s" expr))))

(defun rdebug-watch-delete ()
  (interactive)
  (save-excursion
    (beginning-of-line)
    (if (looking-at "^\\([0-9]+\\):")
        (gud-call (format "undisplay %s" (match-string 1))))))

(defun rdebug-watch-edit (number expr)
  (interactive
   (let ((number nil)
         (expr nil))
