 
 ;; -- General, for all secondary buffers.
 
+
+(defun rdebug-menu-item (common-map name cmd &rest args)
+  "Return a menu item entry with the correct key bindings.
+
+A command can be bound to a number of different key sequences. If
+the rdebug common map contains a binding it is displayed in the
+menu. (The common map typically contains function key bindings.)"
+  (let ((key-binding-list (where-is-internal cmd (list common-map)))
+        (hint '()))
+    (if key-binding-list
+        (setq hint (list :key-sequence (car key-binding-list))))
+    (append (list 'menu-item name cmd)
+            hint
+            args)))
+
+
 ;; Note, we re-populate the menus of the different minor and major
 ;; modes. The reason is that Emacs caches the key bindings, which
 ;; means that wrong ones are shown when buffers are changed.

       (lookup-key (current-local-map) "\C-c")
       t)

      (rdebug-populate-debugger-menu (current-local-map))
      (rdebug-populate-common-keys (current-local-map))

      (setq comint-prompt-regexp "^(rdb:-) ")
      (setq paragraph-start comint-prompt-regexp)

      (define-key menu [layout] (cons "Window Layout" submenu)))

    (define-key map [menu-bar debugger layout initial]
      (rdebug-menu-item common-map
                        "Initial Debugger Layout" 'rdebug-restore-windows))

    (define-key map [menu-bar debugger layout line1] '(menu-item "--"))

    (define-key map [menu-bar debugger layout debugger]
      (rdebug-menu-item common-map "Current Debugger Layout"
                        'rdebug-display-debugger-window-configuration
                        :button
                        '(:radio
                          . (eq rdebug-window-configuration-state 'debugger))))

    (define-key map [menu-bar debugger layout original]
      (rdebug-menu-item common-map "Original Layout"
                        'rdebug-display-original-window-configuration
                        :button
                        '(:radio
                          . (eq rdebug-window-configuration-state 'original))))

    ;; --------------------
    ;; The "View" submeny.
