changeset 105815:cdc718e48308

* menu-bar.el (menu-bar-tools-menu): Add Semantic and EDE menu items. * cedet/cedet.el (cedet-menu-map): Remove Semantic and EDE menu items. * cedet/ede.el (ede-minor-mode): * cedet/semantic.el (semantic-mode): Toggle menu separators.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 31 Oct 2009 18:03:02 +0000
parents d3531eb1d0d5
children fecb02e16f64
files lisp/ChangeLog lisp/cedet/cedet.el lisp/cedet/ede.el lisp/cedet/semantic.el lisp/menu-bar.el
diffstat 5 files changed, 45 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Oct 31 17:12:13 2009 +0000
+++ b/lisp/ChangeLog	Sat Oct 31 18:03:02 2009 +0000
@@ -1,3 +1,14 @@
+2009-10-31  Chong Yidong  <cyd@stupidchicken.com>
+
+	* menu-bar.el (menu-bar-tools-menu): Add Semantic and EDE menu
+	items.
+
+	* cedet/cedet.el (cedet-menu-map): Remove Semantic and EDE menu
+	items.
+
+	* cedet/ede.el (ede-minor-mode):
+	* cedet/semantic.el (semantic-mode): Toggle menu separators.
+
 2009-10-31  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* textmodes/two-column.el (2C-split):
--- a/lisp/cedet/cedet.el	Sat Oct 31 17:12:13 2009 +0000
+++ b/lisp/cedet/cedet.el	Sat Oct 31 18:03:02 2009 +0000
@@ -63,17 +63,7 @@
     (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 Project Support (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)
--- a/lisp/cedet/ede.el	Sat Oct 31 17:12:13 2009 +0000
+++ b/lisp/cedet/ede.el	Sat Oct 31 18:03:02 2009 +0000
@@ -585,27 +585,31 @@
 ;; Activate the EDE items in cedet-menu-map
 
 (define-key cedet-menu-map [ede-find-file]
-  '(menu-item "Find File in Project..." ede-find-file :enable ede-object))
+  '(menu-item "Find File in Project..." ede-find-file :enable ede-object
+	      :visible global-ede-mode))
 (define-key cedet-menu-map [ede-speedbar]
-  '(menu-item "View Project Tree" ede-speedbar :enable ede-object))
+  '(menu-item "View Project Tree" ede-speedbar :enable ede-object
+	      :visible global-ede-mode))
 (define-key cedet-menu-map [ede]
-  '(menu-item "Load Project" ede))
+  '(menu-item "Load Project" ede
+	      :visible global-ede-mode))
 (define-key cedet-menu-map [ede-new]
   '(menu-item "Create Project" ede-new
-	      :enable (not ede-object)))
+	      :enable (not ede-object)
+	      :visible global-ede-mode))
 (define-key cedet-menu-map [ede-target-options]
   '(menu-item "Target Options" ede-target-options
-	      :filter ede-target-forms-menu))
+	      :filter ede-target-forms-menu
+	      :visible global-ede-mode))
 (define-key cedet-menu-map [ede-project-options]
   '(menu-item "Project Options" ede-project-options
-	      :filter ede-project-forms-menu))
+	      :filter ede-project-forms-menu
+	      :visible global-ede-mode))
 (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] '("--"))
+	      :enable ede-object
+	      :visible global-ede-mode))
 
 (defun ede-menu-obj-of-class-p (class)
   "Return non-nil if some member of `ede-object' is a child of CLASS."
@@ -841,6 +845,8 @@
   (if global-ede-mode
       ;; Turn on global-ede-mode
       (progn
+	(if semantic-mode
+	    (define-key cedet-menu-map [cedet-menu-separator] '("--")))
 	(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)
@@ -850,6 +856,7 @@
 	(ede-load-cache)
 	(ede-reset-all-buffers 1))
     ;; Turn off global-ede-mode
+    (define-key cedet-menu-map [cedet-menu-separator] nil)
     (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)
--- a/lisp/cedet/semantic.el	Sat Oct 31 17:12:13 2009 +0000
+++ b/lisp/cedet/semantic.el	Sat Oct 31 18:03:02 2009 +0000
@@ -1002,10 +1002,7 @@
     '(menu-item "Reparse When Idle" global-semantic-idle-scheduler-mode
 		:help "Keep a buffer's parse tree up to date when idle"
 		:visible semantic-mode
-		:button (:toggle . global-semantic-idle-scheduler-mode)))
-  (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] '("--")))
+		:button (:toggle . global-semantic-idle-scheduler-mode))))
 
 ;; The `semantic-mode' command, in conjuction with the
 ;; `semantic-default-submodes' variable, toggles Semantic's various
@@ -1076,11 +1073,15 @@
 	    (require 'semantic/db-ebrowse)
 	    (semanticdb-load-ebrowse-caches)))
 	(add-hook 'mode-local-init-hook 'semantic-new-buffer-fcn)
+	(if global-ede-mode
+	    (define-key cedet-menu-map [cedet-menu-separator] '("--")))
 	(dolist (b (buffer-list))
 	  (with-current-buffer b
 	    (semantic-new-buffer-fcn))))
     ;; Disable all Semantic features.
     (remove-hook 'mode-local-init-hook 'semantic-new-buffer-fcn)
+    (define-key cedet-menu-map [cedet-menu-separator] nil)
+    (define-key cedet-menu-map [semantic-options-separator] nil)
     ;; FIXME: handle semanticdb-load-ebrowse-caches
     (dolist (mode semantic-submode-list)
       (if (and (boundp mode) (eval mode))
--- a/lisp/menu-bar.el	Sat Oct 31 17:12:13 2009 +0000
+++ b/lisp/menu-bar.el	Sat Oct 31 18:03:02 2009 +0000
@@ -1326,6 +1326,18 @@
 (define-key menu-bar-tools-menu [separator-prog]
   '("--"))
 
+(define-key menu-bar-tools-menu [semantic]
+  `(menu-item ,(purecopy "Source Code Parsers (Semantic)")
+	      semantic-mode
+	      :help ,(purecopy "Toggle automatic parsing in source code buffers (Semantic mode)")
+	      :button (:toggle . (bound-and-true-p semantic-mode))))
+
+(define-key menu-bar-tools-menu [ede]
+  `(menu-item ,(purecopy "Project support (EDE)")
+	      global-ede-mode
+	      :help ,(purecopy "Toggle the Emacs Development Environment (Global EDE mode)")
+	      :button (:toggle . (bound-and-true-p global-ede-mode))))
+
 (define-key menu-bar-tools-menu [gdb]
   `(menu-item ,(purecopy "Debugger (GDB)...") gdb
 	      :help ,(purecopy "Debug a program from within Emacs with GDB")))