changeset 104523:18ae68cd64bd

* cedet/ede.el (global-ede-mode-map): Move menu to global-ede-mode-map. (ede-minor-mode, global-ede-mode): Use define-minor-mode. * cedet/semantic.el (semantic-mode-map): Use cedet-menu-map. * cedet/cedet.el (cedet-menu-map): New var. Don't require Semantic etc.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 27 Sep 2009 17:50:53 +0000
parents 2a2b8ae24b17
children fbd55cc47b77
files lisp/ChangeLog lisp/cedet/cedet.el lisp/cedet/ede.el lisp/cedet/semantic.el
diffstat 4 files changed, 259 insertions(+), 212 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Sep 27 03:59:51 2009 +0000
+++ b/lisp/ChangeLog	Sun Sep 27 17:50:53 2009 +0000
@@ -1,3 +1,14 @@
+2009-09-27  Chong Yidong  <cyd@stupidchicken.com>
+
+	* cedet/ede.el (global-ede-mode-map): Move menu to
+	global-ede-mode-map.
+	(ede-minor-mode, global-ede-mode): Use define-minor-mode.
+
+	* cedet/semantic.el (semantic-mode-map): Use cedet-menu-map.
+
+	* cedet/cedet.el (cedet-menu-map): New var.  Don't require
+	Semantic etc.
+
 2009-09-27  Chong Yidong  <cyd@stupidchicken.com>
 
 	* cedet/semantic/symref/list.el: Require semantic/complete.
--- a/lisp/cedet/cedet.el	Sun Sep 27 03:59:51 2009 +0000
+++ b/lisp/cedet/cedet.el	Sun Sep 27 17:50:53 2009 +0000
@@ -34,15 +34,11 @@
 (eval-when-compile
   (require 'cl))
 
+(declare-function inversion-find-version "inversion")
+
 (defconst cedet-version "1.0pre7"
   "Current version of CEDET.")
 
-(require 'eieio)
-(require 'semantic)
-(require 'srecode)
-(require 'ede)
-(require 'speedbar)
-
 (defconst cedet-packages
   `(
     ;;PACKAGE   MIN-VERSION
@@ -54,7 +50,40 @@
     (speedbar      "1.0.3"))
   "Table of CEDET packages to install.")
 
-(declare-function inversion-find-version "inversion")
+(defvar cedet-menu-map ;(make-sparse-keymap "CEDET menu")
+  (let ((map (make-sparse-keymap "CEDET menu")))
+    (define-key map [semantic-force-refresh]     'undefined)
+    (define-key map [semantic-edit-menu]         'undefined)
+    (define-key map [navigate-menu]              'undefined)
+    (define-key map [semantic-options-separator] 'undefined)
+    (define-key map [global-semantic-highlight-func-mode]   'undefined)
+    (define-key map [global-semantic-highlight-func-mode]   'undefined)
+    (define-key map [global-semantic-decoration-mode]       'undefined)
+    (define-key map [global-semantic-idle-completions-mode] 'undefined)
+    (define-key map [global-semantic-idle-summary-mode]     'undefined)
+    (define-key map [global-semanticdb-minor-mode]          'undefined)
+    (define-key map [global-semantic-idle-scheduler-mode]   'undefined)
+    (define-key map [semantic-menu-separator] '("--"))
+    (define-key map [semantic-mode]
+      '(menu-item "Enable parsers (Semantic)" semantic-mode
+		  :help "Enable language parsers (Semantic)"
+		  :visible (not (bound-and-true-p semantic-mode))))
+    (define-key map [cedet-menu-separator] 'undefined)
+    (define-key map [ede-mode]
+      '(menu-item "Enable Projects (EDE)" global-ede-mode
+		  :help "Enable the Emacs Development Environment (EDE)"
+		  :visible (not (bound-and-true-p global-ede-mode))))
+    (define-key map [ede-menu-separator] '("--"))
+    (define-key map [ede-find-file]        'undefined)
+    (define-key map [ede-speedbar]         'undefined)
+    (define-key map [ede] 'undefined)
+    (define-key map [ede-new]              'undefined)
+    (define-key map [ede-target-options]   'undefined)
+    (define-key map [ede-project-options]  'undefined)
+    (define-key map [ede-build-forms-menu] 'undefined)
+    map)
+  "Menu keymap for the CEDET package.
+This is used by `semantic-mode' and `global-ede-mode'.")
 
 (defun cedet-version ()
   "Display all active versions of CEDET and Dependant packages.
--- a/lisp/cedet/ede.el	Sun Sep 27 03:59:51 2009 +0000
+++ b/lisp/cedet/ede.el	Sun Sep 27 17:50:53 2009 +0000
@@ -39,6 +39,7 @@
 ;;
 ;;  (global-ede-mode t)
 
+(require 'cedet)
 (require 'eieio)
 (require 'eieio-speedbar)
 (require 'ede/source)
@@ -549,14 +550,7 @@
 
 ;;; Menu and Keymap
 
-(defvar ede-minor-mode nil
-  "Non-nil in EDE controlled buffers.")
-(make-variable-buffer-local 'ede-minor-mode)
-
-;; We don't want to waste space.  There is a menu after all.
-(add-to-list 'minor-mode-alist '(ede-minor-mode ""))
-
-(defvar ede-minor-keymap
+(defvar ede-minor-mode-map
   (let ((map (make-sparse-keymap))
 	(pmap (make-sparse-keymap)))
     (define-key pmap "e" 'ede-edit-file-target)
@@ -576,32 +570,37 @@
     map)
   "Keymap used in project minor mode.")
 
-(if ede-minor-keymap
-    (progn
-      (easy-menu-define
-       ede-minor-menu ede-minor-keymap "Project Minor Mode Menu"
-       '("Project"
-	 ( "Build" :filter ede-build-forms-menu )
-	 ( "Project Options" :filter ede-project-forms-menu )
-	 ( "Target Options" :filter ede-target-forms-menu )
-	 [ "Create Project" ede-new (not ede-object) ]
-	 [ "Load a project" ede t ]
-;;	 [ "Select Active Target" 'undefined nil ]
-;;	 [ "Remove Project" 'undefined nil ]
-	 "---"
-	 [ "Find File in Project..." ede-find-file t ]
-	 ( "Customize" :filter ede-customize-forms-menu )
-	 [ "View Project Tree" ede-speedbar t ]
-	 ))
-      ))
+(defvar global-ede-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [menu-bar cedet-menu]
+      (cons "Development" cedet-menu-map))
+    map)
+  "Keymap used in `global-ede-mode'")
+
+;; Activate the EDE items in cedet-menu-map
 
-;; Allow re-insertion of a new keymap
-(let ((a (assoc 'ede-minor-mode minor-mode-map-alist)))
-  (if a
-      (setcdr a ede-minor-keymap)
-    (add-to-list 'minor-mode-map-alist
-		 (cons 'ede-minor-mode ede-minor-keymap))
-    ))
+(define-key cedet-menu-map [ede-find-file]
+  '(menu-item "Find File in Project..." ede-find-file :enable ede-object))
+(define-key cedet-menu-map [ede-speedbar]
+  '(menu-item "View Project Tree" ede-speedbar :enable ede-object))
+(define-key cedet-menu-map [ede]
+  '(menu-item "Load Project" ede))
+(define-key cedet-menu-map [ede-new]
+  '(menu-item "Create Project" ede-new
+	      :enable (not ede-object)))
+(define-key cedet-menu-map [ede-target-options]
+  '(menu-item "Target Options" ede-target-options
+	      :filter ede-target-forms-menu))
+(define-key cedet-menu-map [ede-project-options]
+  '(menu-item "Project Options" ede-project-options
+	      :filter ede-project-forms-menu))
+(define-key cedet-menu-map [ede-build-forms-menu]
+  '(menu-item "Build Project" ede-build-forms-menu
+	      :filter ede-build-forms-menu
+	      :enable ede-object))
+(define-key cedet-menu-map [semantic-menu-separator] 'undefined)
+(define-key cedet-menu-map [cedet-menu-separator] 'undefined)
+(define-key cedet-menu-map [ede-menu-separator] '("--"))
 
 (defun ede-menu-obj-of-class-p (class)
   "Return non-nil if some member of `ede-object' is a child of CLASS."
@@ -781,40 +780,36 @@
 	  (eq major-mode 'vc-dired-mode))
       (ede-minor-mode 1)))
 
-(defun ede-minor-mode (&optional arg)
-  "Project minor mode.
-If this file is contained, or could be contained in an EDE
-controlled project, then this mode should be active.
+(define-minor-mode ede-minor-mode
+  "Toggle EDE (Emacs Development Environment) minor mode.
+With non-nil argument ARG, enable EDE minor mode if ARG is
+positive; otherwise, disable it.
 
-With argument ARG positive, turn on the mode.  Negative, turn off the
-mode.  nil means to toggle the mode."
-  (interactive "P")
-  (if (or (eq major-mode 'dired-mode)
-	  (eq major-mode 'vc-dired-mode))
-      (ede-dired-minor-mode arg)
-    (progn
-      (setq ede-minor-mode
-	    (not (or (and (null arg) ede-minor-mode)
-		     (<= (prefix-numeric-value arg) 0))))
-      (if (and ede-minor-mode (not ede-constructing)
-	       (ede-directory-project-p default-directory t))
-	  (let* ((ROOT nil)
-		 (proj (ede-directory-get-open-project default-directory
-						       'ROOT)))
-	    (when (not proj)
-	      ;; @todo - this could be wasteful.
-	      (setq proj (ede-load-project-file default-directory 'ROOT)))
-
-	    (setq ede-object-project proj)
-	    (setq ede-object-root-project
-		  (or ROOT (ede-project-root proj)))
-	    (setq ede-object (ede-buffer-object))
-	    (if (and (not ede-object) ede-object-project)
-		(ede-auto-add-to-target))
-	    (ede-apply-target-options))
-	;; If we fail to have a project here, turn it back off.
-	(if (not (interactive-p))
-	    (setq ede-minor-mode nil))))))
+If this file is contained, or could be contained in an EDE
+controlled project, then this mode is activated automatically
+provided `global-ede-mode' is enabled."
+  :group 'ede
+  (cond ((or (eq major-mode 'dired-mode)
+	     (eq major-mode 'vc-dired-mode))
+	 (ede-dired-minor-mode (if ede-minor-mode 1 -1)))
+	(ede-minor-mode
+	 (if (and (not ede-constructing)
+		  (ede-directory-project-p default-directory t))
+	     (let* ((ROOT nil)
+		    (proj (ede-directory-get-open-project default-directory
+							  'ROOT)))
+	       (when (not proj)
+		 ;; @todo - this could be wasteful.
+		 (setq proj (ede-load-project-file default-directory 'ROOT)))
+	       (setq ede-object-project proj)
+	       (setq ede-object-root-project
+		     (or ROOT (ede-project-root proj)))
+	       (setq ede-object (ede-buffer-object))
+	       (if (and (not ede-object) ede-object-project)
+		   (ede-auto-add-to-target))
+	       (ede-apply-target-options))
+	   ;; If we fail to have a project here, turn it back off.
+	   (ede-minor-mode -1)))))
 
 (defun ede-reset-all-buffers (onoff)
   "Reset all the buffers due to change in EDE.
@@ -827,31 +822,35 @@
       (setq b (cdr b)))))
 
 ;;;###autoload
-(defun global-ede-mode (arg)
-  "Turn on variable `ede-minor-mode' mode when ARG is positive.
-If ARG is negative, disable.  Toggle otherwise."
-  (interactive "P")
-  (if (not arg)
-      (if (member 'ede-turn-on-hook find-file-hook)
-	  (global-ede-mode -1)
-	(global-ede-mode 1))
-    (if (or (eq arg t) (> arg 0))
-	(progn
-	  (add-hook 'semanticdb-project-predicate-functions 'ede-directory-project-p)
-	  (add-hook 'semanticdb-project-root-functions 'ede-toplevel-project-or-nil)
-	  (add-hook 'ecb-source-path-functions 'ede-ecb-project-paths)
-	  (add-hook 'find-file-hook 'ede-turn-on-hook)
-	  (add-hook 'dired-mode-hook 'ede-turn-on-hook)
-	  (add-hook 'kill-emacs-hook 'ede-save-cache)
-	  (ede-load-cache))
-      (remove-hook 'semanticdb-project-predicate-functions 'ede-directory-project-p)
-      (remove-hook 'semanticdb-project-root-functions 'ede-toplevel-project-or-nil)
-      (remove-hook 'ecb-source-path-functions 'ede-ecb-project-paths)
-      (remove-hook 'find-file-hook 'ede-turn-on-hook)
-      (remove-hook 'dired-mode-hook 'ede-turn-on-hook)
-      (remove-hook 'kill-emacs-hook 'ede-save-cache)
-      (ede-save-cache))
-    (ede-reset-all-buffers arg)))
+(define-minor-mode global-ede-mode
+  "Toggle global EDE (Emacs Development Environment) mode.
+With non-nil argument ARG, enable global EDE mode if ARG is
+positive; otherwise, disable it.
+
+This global minor mode enables `ede-minor-mode' in all buffers in
+an EDE controlled project."
+  :global t
+  :group 'ede
+  (if global-ede-mode
+      ;; Turn on global-ede-mode
+      (progn
+	(add-hook 'semanticdb-project-predicate-functions 'ede-directory-project-p)
+	(add-hook 'semanticdb-project-root-functions 'ede-toplevel-project-or-nil)
+	(add-hook 'ecb-source-path-functions 'ede-ecb-project-paths)
+	(add-hook 'find-file-hook 'ede-turn-on-hook)
+	(add-hook 'dired-mode-hook 'ede-turn-on-hook)
+	(add-hook 'kill-emacs-hook 'ede-save-cache)
+	(ede-load-cache)
+	(ede-reset-all-buffers 1))
+    ;; Turn off global-ede-mode
+    (remove-hook 'semanticdb-project-predicate-functions 'ede-directory-project-p)
+    (remove-hook 'semanticdb-project-root-functions 'ede-toplevel-project-or-nil)
+    (remove-hook 'ecb-source-path-functions 'ede-ecb-project-paths)
+    (remove-hook 'find-file-hook 'ede-turn-on-hook)
+    (remove-hook 'dired-mode-hook 'ede-turn-on-hook)
+    (remove-hook 'kill-emacs-hook 'ede-save-cache)
+    (ede-save-cache)
+    (ede-reset-all-buffers -1)))
 
 (defvar ede-ignored-file-alist
   '( "\\.cvsignore$"
--- a/lisp/cedet/semantic.el	Sun Sep 27 03:59:51 2009 +0000
+++ b/lisp/cedet/semantic.el	Sun Sep 27 17:50:53 2009 +0000
@@ -30,6 +30,7 @@
 ;; designed to handle typical functional and object oriented languages.
 
 (require 'assoc)
+(require 'cedet)
 (require 'semantic/tag)
 (require 'semantic/lex)
 
@@ -830,121 +831,12 @@
 Throw away all the old tags, and recreate the tag database."
   (interactive)
   (semantic-clear-toplevel-cache)
-  (semantic-fetch-tags))
+  (semantic-fetch-tags)
+  (message "Buffer reparsed."))
 
 (defvar semantic-mode-map
-  (let ((map (make-sparse-keymap))
-	(menu (make-sparse-keymap "Semantic"))
-	(navigate-menu (make-sparse-keymap "Navigate Tags"))
-	(edit-menu (make-sparse-keymap "Edit Tags")))
-
-    (define-key edit-menu [semantic-analyze-possible-completions]
-      '(menu-item "List Completions" semantic-analyze-possible-completions
-		  :help "Display a list of completions for the tag at point"))
-    (define-key edit-menu [semantic-complete-analyze-inline]
-      '(menu-item "Complete Tag Inline" semantic-complete-analyze-inline
-		  :help "Display inline completion for the tag at point"))
-    (define-key edit-menu [semantic-completion-separator]
-      '("--"))
-    (define-key edit-menu [senator-transpose-tags-down]
-      '(menu-item "Transpose Tags Down" senator-transpose-tags-down
-		  :active (semantic-current-tag)
-		  :help "Transpose the current tag and the next tag"))
-    (define-key edit-menu [senator-transpose-tags-up]
-      '(menu-item "Transpose Tags Up" senator-transpose-tags-up
-		  :active (semantic-current-tag)
-		  :help "Transpose the current tag and the previous tag"))
-    (define-key edit-menu [semantic-edit-separator]
-      '("--"))
-    (define-key edit-menu [senator-yank-tag]
-      '(menu-item "Yank Tag" senator-yank-tag
-		  :active (not (ring-empty-p senator-tag-ring))
-		  :help "Yank the head of the tag ring into the buffer"))
-    (define-key edit-menu [senator-copy-tag-to-register]
-      '(menu-item "Copy Tag To Register" senator-copy-tag-to-register
-		  :active (semantic-current-tag)
-		  :help "Yank the head of the tag ring into the buffer"))
-    (define-key edit-menu [senator-copy-tag]
-      '(menu-item "Copy Tag" senator-copy-tag
-		  :active (semantic-current-tag)
-		  :help "Copy the current tag to the tag ring"))
-    (define-key edit-menu [senator-kill-tag]
-      '(menu-item "Kill Tag" senator-kill-tag
-		  :active (semantic-current-tag)
-		  :help "Kill the current tag, and copy it to the tag ring"))
-
-    (define-key navigate-menu [senator-narrow-to-defun]
-      '(menu-item "Narrow to Tag" senator-narrow-to-defun
-		  :active (semantic-current-tag)
-		  :help "Narrow the buffer to the bounds of the current tag"))
-    (define-key navigate-menu [semantic-narrow-to-defun-separator]
-      '("--"))
-    (define-key navigate-menu [semantic-symref-symbol]
-      '(menu-item "Find Tag References..." semantic-symref-symbol
-		  :help "Read a tag and list the references to it"))
-    (define-key navigate-menu [semantic-complete-jump]
-      '(menu-item "Find Tag Globally..." semantic-complete-jump
-		  :help "Read a tag name and find it in the current project"))
-    (define-key navigate-menu [semantic-complete-jump-local]
-      '(menu-item "Find Tag in This Buffer..." semantic-complete-jump-local
-		  :help "Read a tag name and find it in this buffer"))
-    (define-key navigate-menu [semantic-navigation-separator]
-      '("--"))
-    (define-key navigate-menu [senator-go-to-up-reference]
-      '(menu-item "Parent Tag" senator-go-to-up-reference
-		  :help "Navigate up one reference by tag."))
-    (define-key navigate-menu [senator-next-tag]
-      '(menu-item "Next Tag" senator-next-tag
-		  :help "Go to the next tag"))
-    (define-key navigate-menu [senator-previous-tag]
-      '(menu-item "Previous Tag" senator-previous-tag
-		  :help "Go to the previous tag"))
-
-    (define-key menu [semantic-force-refresh]
-      '(menu-item "Reparse Buffer" semantic-force-refresh
-		  :help "Force a full reparse of the current buffer."))
-    (define-key menu [semantic-refresh-separator]
-      '("--"))
-    (define-key menu [edit-menu]
-      (cons "Edit Tags" edit-menu))
-    (define-key menu [navigate-menu]
-      (cons "Navigate Tags" navigate-menu))
-    (define-key menu [semantic-options-separator]
-      '("--"))
-    (define-key menu [global-semantic-highlight-func-mode]
-      (menu-bar-make-mm-toggle
-       global-semantic-highlight-func-mode
-       "Highlight Current Function"
-       "Highlight the tag at point"))
-    (define-key menu [global-semantic-decoration-mode]
-      (menu-bar-make-mm-toggle
-       global-semantic-decoration-mode
-       "Decorate Tags"
-       "Decorate tags based on various attributes"))
-    (define-key menu [global-semantic-idle-completions-mode]
-      (menu-bar-make-mm-toggle
-       global-semantic-idle-completions-mode
-       "Show Tag Completions"
-       "Show tag completions when idle"))
-    (define-key menu [global-semantic-idle-summary-mode]
-      (menu-bar-make-mm-toggle
-       global-semantic-idle-summary-mode
-       "Show Tag Summaries"
-       "Show tag summaries when idle"))
-    (define-key menu [global-semanticdb-minor-mode]
-      '(menu-item "Semantic Database" global-semanticdb-minor-mode
-		  :help "Store tag information in a database"
-		  :button (:toggle . (semanticdb-minor-mode-p))))
-    (define-key menu [global-semantic-idle-scheduler-mode]
-      (menu-bar-make-mm-toggle
-       global-semantic-idle-scheduler-mode
-       "Reparse When Idle"
-       "Keep a buffer's parse tree up to date when idle"))
-    (define-key map [menu-bar semantic]
-      (cons "Development" menu))
-
+  (let ((map (make-sparse-keymap)))
     ;; Key bindings:
-
     ;; (define-key km "f"    'senator-search-set-tag-class-filter)
     ;; (define-key km "i"    'senator-isearch-toggle-semantic-mode)
     (define-key map "\C-c,j" 'semantic-complete-jump-local)
@@ -962,13 +854,129 @@
     (define-key map [?\C-c ?, up] 'senator-transpose-tags-up)
     (define-key map [?\C-c ?, down] 'senator-transpose-tags-down)
     (define-key map "\C-c,l" 'semantic-analyze-possible-completions)
+    ;; This hack avoids showing the CEDET menu twice if ede-minor-mode
+    ;; and Semantic are both enabled.  Is there a better way?
+    (define-key map [menu-bar cedet-menu]
+      (list 'menu-item "Development" cedet-menu-map
+	    :enable (quote (not (bound-and-true-p global-ede-mode)))))
     ;; (define-key km "-"    'senator-fold-tag)
     ;; (define-key km "+"    'senator-unfold-tag)
     map))
 
+;; Activate the Semantic items in cedet-menu-map
+(let ((navigate-menu (make-sparse-keymap "Navigate Tags"))
+      (edit-menu (make-sparse-keymap "Edit Tags")))
+
+  ;; Edit Tags submenu:
+  (define-key edit-menu [semantic-analyze-possible-completions]
+    '(menu-item "List Completions" semantic-analyze-possible-completions
+		:help "Display a list of completions for the tag at point"))
+  (define-key edit-menu [semantic-complete-analyze-inline]
+    '(menu-item "Complete Tag Inline" semantic-complete-analyze-inline
+		:help "Display inline completion for the tag at point"))
+  (define-key edit-menu [semantic-completion-separator]
+    '("--"))
+  (define-key edit-menu [senator-transpose-tags-down]
+    '(menu-item "Transpose Tags Down" senator-transpose-tags-down
+		:active (semantic-current-tag)
+		:help "Transpose the current tag and the next tag"))
+  (define-key edit-menu [senator-transpose-tags-up]
+    '(menu-item "Transpose Tags Up" senator-transpose-tags-up
+		:active (semantic-current-tag)
+		:help "Transpose the current tag and the previous tag"))
+  (define-key edit-menu [semantic-edit-separator]
+    '("--"))
+  (define-key edit-menu [senator-yank-tag]
+    '(menu-item "Yank Tag" senator-yank-tag
+		:active (not (ring-empty-p senator-tag-ring))
+		:help "Yank the head of the tag ring into the buffer"))
+  (define-key edit-menu [senator-copy-tag-to-register]
+    '(menu-item "Copy Tag To Register" senator-copy-tag-to-register
+		:active (semantic-current-tag)
+		:help "Yank the head of the tag ring into the buffer"))
+  (define-key edit-menu [senator-copy-tag]
+    '(menu-item "Copy Tag" senator-copy-tag
+		:active (semantic-current-tag)
+		:help "Copy the current tag to the tag ring"))
+  (define-key edit-menu [senator-kill-tag]
+    '(menu-item "Kill Tag" senator-kill-tag
+		:active (semantic-current-tag)
+		:help "Kill the current tag, and copy it to the tag ring"))
+
+  ;; Navigate Tags submenu:
+  (define-key navigate-menu [senator-narrow-to-defun]
+    '(menu-item "Narrow to Tag" senator-narrow-to-defun
+		:active (semantic-current-tag)
+		:help "Narrow the buffer to the bounds of the current tag"))
+  (define-key navigate-menu [semantic-narrow-to-defun-separator]
+    '("--"))
+  (define-key navigate-menu [semantic-symref-symbol]
+    '(menu-item "Find Tag References..." semantic-symref-symbol
+		:help "Read a tag and list the references to it"))
+  (define-key navigate-menu [semantic-complete-jump]
+    '(menu-item "Find Tag Globally..." semantic-complete-jump
+		:help "Read a tag name and find it in the current project"))
+  (define-key navigate-menu [semantic-complete-jump-local]
+    '(menu-item "Find Tag in This Buffer..." semantic-complete-jump-local
+		:help "Read a tag name and find it in this buffer"))
+  (define-key navigate-menu [semantic-navigation-separator]
+    '("--"))
+  (define-key navigate-menu [senator-go-to-up-reference]
+    '(menu-item "Parent Tag" senator-go-to-up-reference
+		:help "Navigate up one reference by tag."))
+  (define-key navigate-menu [senator-next-tag]
+    '(menu-item "Next Tag" senator-next-tag
+		:help "Go to the next tag"))
+  (define-key navigate-menu [senator-previous-tag]
+    '(menu-item "Previous Tag" senator-previous-tag
+		:help "Go to the previous tag"))
+
+  ;; Top level menu items:
+  (define-key cedet-menu-map [semantic-force-refresh]
+    '(menu-item "Reparse Buffer" semantic-force-refresh
+		:help "Force a full reparse of the current buffer."))
+  (define-key cedet-menu-map [semantic-edit-menu]
+    (cons "Edit Tags" edit-menu))
+  (define-key cedet-menu-map [navigate-menu]
+    (cons "Navigate Tags" navigate-menu))
+  (define-key cedet-menu-map [semantic-options-separator]
+    '("--"))
+  (define-key cedet-menu-map [global-semantic-highlight-func-mode]
+    (menu-bar-make-mm-toggle
+     global-semantic-highlight-func-mode
+     "Highlight Current Function"
+     "Highlight the tag at point"))
+  (define-key cedet-menu-map [global-semantic-decoration-mode]
+    (menu-bar-make-mm-toggle
+     global-semantic-decoration-mode
+     "Decorate Tags"
+     "Decorate tags based on various attributes"))
+  (define-key cedet-menu-map [global-semantic-idle-completions-mode]
+    (menu-bar-make-mm-toggle
+     global-semantic-idle-completions-mode
+     "Show Tag Completions"
+     "Show tag completions when idle"))
+  (define-key cedet-menu-map [global-semantic-idle-summary-mode]
+    (menu-bar-make-mm-toggle
+     global-semantic-idle-summary-mode
+     "Show Tag Summaries"
+     "Show tag summaries when idle"))
+  (define-key cedet-menu-map [global-semanticdb-minor-mode]
+    '(menu-item "Semantic Database" global-semanticdb-minor-mode
+		:help "Store tag information in a database"
+		:button (:toggle . (semanticdb-minor-mode-p))))
+  (define-key cedet-menu-map [global-semantic-idle-scheduler-mode]
+    (menu-bar-make-mm-toggle
+     global-semantic-idle-scheduler-mode
+     "Reparse When Idle"
+     "Keep a buffer's parse tree up to date when idle"))
+  (define-key cedet-menu-map [ede-menu-separator] 'undefined)
+  (define-key cedet-menu-map [cedet-menu-separator] 'undefined)
+  (define-key cedet-menu-map [semantic-menu-separator] '("--")))
+
 ;; The `semantic-mode' command, in conjuction with the
-;; `semantic-default-submodes' variable, are used to collectively
-;; toggle Semantic's various auxilliary minor modes.
+;; `semantic-default-submodes' variable, toggles Semantic's various
+;; auxilliary minor modes.
 
 (defvar semantic-load-system-cache-loaded nil
   "Non nil when the Semantic system caches have been loaded.