changeset 108210:5143700578d0

Use define-minor-mode in CEDET where applicable. * cedet/srecode/mode.el (srecode-minor-mode,global-srecode-minor-mode): Use define-minor-mode. * cedet/semantic/util-modes.el (semantic-add-minor-mode): Remove unused arg `keymap' and code redundant with define-minor-mode. (semantic-toggle-minor-mode-globally): Only handle arg -1 and 1. (semantic-stickyfunc-mode, global-semantic-show-unmatched-syntax-mode) (semantic-highlight-func-mode, global-semantic-show-parser-state-mode) (global-semantic-highlight-edits-mode, semantic-highlight-edits-mode) (semantic-show-unmatched-syntax-mode, semantic-show-parser-state-mode) (global-semantic-stickyfunc-mode, global-semantic-highlight-func-mode): Use define-minor-mode. (semantic-stickyfunc-mode-setup, semantic-highlight-edits-mode-setup) (semantic-show-unmatched-syntax-mode-setup) (semantic-show-parser-state-mode-setup) (semantic-highlight-func-mode-setup): Inline into sole caller. * cedet/semantic/mru-bookmark.el (global-semantic-mru-bookmark-mode) (semantic-mru-bookmark-mode): Use define-minor-mode. (semantic-mru-bookmark-mode-setup): Inline into sole caller. * cedet/semantic/idle.el (define-semantic-idle-service): Use define-minor-mode and inline setup function into its sole caller. (semantic-idle-scheduler-mode-setup) (semantic-idle-summary-mode-setup): Inline into sole caller. (global-semantic-idle-scheduler-mode, semantic-idle-scheduler-mode): Use define-minor-mode. * cedet/semantic/decorate/mode.el (global-semantic-decoration-mode) (semantic-decoration-mode): Use define-minor-mode. (semantic-decoration-mode-setup): Inline into sole caller. * cedet/ede/dired.el (ede-dired-minor-mode): Initialize in declaration. (ede-dired-minor-mode): Use define-minor-mode and derived-mode-p. (ede-dired-add-to-target): Use dolist.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 01 May 2010 23:38:19 -0400
parents b757d9aee37e
children 73a1ddc06d0e
files lisp/ChangeLog lisp/cedet/ede/dired.el lisp/cedet/semantic/decorate/mode.el lisp/cedet/semantic/idle.el lisp/cedet/semantic/mru-bookmark.el lisp/cedet/semantic/util-modes.el lisp/cedet/srecode/mode.el
diffstat 7 files changed, 313 insertions(+), 715 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat May 01 22:39:50 2010 -0400
+++ b/lisp/ChangeLog	Sat May 01 23:38:19 2010 -0400
@@ -1,3 +1,43 @@
+2010-05-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	Use define-minor-mode in CEDET where applicable.
+
+	* cedet/srecode/mode.el (srecode-minor-mode,global-srecode-minor-mode):
+	Use define-minor-mode.
+
+	* cedet/semantic/util-modes.el (semantic-add-minor-mode):
+	Remove unused arg `keymap' and code redundant with define-minor-mode.
+	(semantic-toggle-minor-mode-globally): Only handle arg -1 and 1.
+	(semantic-stickyfunc-mode, global-semantic-show-unmatched-syntax-mode)
+	(semantic-highlight-func-mode, global-semantic-show-parser-state-mode)
+	(global-semantic-highlight-edits-mode, semantic-highlight-edits-mode)
+	(semantic-show-unmatched-syntax-mode, semantic-show-parser-state-mode)
+	(global-semantic-stickyfunc-mode, global-semantic-highlight-func-mode):
+	Use define-minor-mode.
+	(semantic-stickyfunc-mode-setup, semantic-highlight-edits-mode-setup)
+	(semantic-show-unmatched-syntax-mode-setup)
+	(semantic-show-parser-state-mode-setup)
+	(semantic-highlight-func-mode-setup): Inline into sole caller.
+
+	* cedet/semantic/mru-bookmark.el (global-semantic-mru-bookmark-mode)
+	(semantic-mru-bookmark-mode): Use define-minor-mode.
+	(semantic-mru-bookmark-mode-setup): Inline into sole caller.
+
+	* cedet/semantic/idle.el (define-semantic-idle-service):
+	Use define-minor-mode and inline setup function into its sole caller.
+	(semantic-idle-scheduler-mode-setup)
+	(semantic-idle-summary-mode-setup): Inline into sole caller.
+	(global-semantic-idle-scheduler-mode, semantic-idle-scheduler-mode):
+	Use define-minor-mode.
+
+	* cedet/semantic/decorate/mode.el (global-semantic-decoration-mode)
+	(semantic-decoration-mode): Use define-minor-mode.
+	(semantic-decoration-mode-setup): Inline into sole caller.
+
+	* cedet/ede/dired.el (ede-dired-minor-mode): Initialize in declaration.
+	(ede-dired-minor-mode): Use define-minor-mode and derived-mode-p.
+	(ede-dired-add-to-target): Use dolist.
+
 2010-05-01  Toru TSUNEYOSHI <t_tuneyosi@hotmail.com>
 	    Michael Albinus  <michael.albinus@gmx.de>
 
@@ -8,8 +48,8 @@
 	(tramp-inline-compress-commands): New defconst.
 	(tramp-find-inline-compress, tramp-get-inline-compress)
 	(tramp-get-inline-coding): New defuns.
-	(tramp-get-remote-coding, tramp-get-local-coding): Removed,
-	replaced by `tramp-get-inline-coding'.
+	(tramp-get-remote-coding, tramp-get-local-coding): Remove,
+	replace by `tramp-get-inline-coding'.
 	(tramp-handle-file-local-copy, tramp-handle-write-region)
 	(tramp-method-out-of-band-p): Use `tramp-get-inline-coding'.
 
@@ -41,8 +81,7 @@
 
 2010-04-30  Chong Yidong  <cyd@stupidchicken.com>
 
-	* minibuffer.el (tags-completion-at-point-function): Fix return
-	value.
+	* minibuffer.el (tags-completion-at-point-function): Fix return value.
 
 2010-04-30  Eli Zaretskii  <eliz@gnu.org>
 
--- a/lisp/cedet/ede/dired.el	Sat May 01 22:39:50 2010 -0400
+++ b/lisp/cedet/ede/dired.el	Sat May 01 23:38:19 2010 -0400
@@ -27,57 +27,46 @@
 ;; This provides a dired interface to EDE, allowing users to modify
 ;; their project file by adding files (or whatever) directly from a
 ;; dired buffer.
-
+(eval-when-compile (require 'cl))
 (require 'easymenu)
 (require 'dired)
 (require 'ede)
 
 ;;; Code:
-(defvar ede-dired-minor-mode nil
-  "Non-nil when in ede dired minor mode.")
-(make-variable-buffer-local 'ede-dired-minor-mode)
+(defvar ede-dired-keymap
+  (let ((map (make-sparse-keymap)))
+    (define-key map ".a" 'ede-dired-add-to-target)
+    (define-key map ".t" 'ede-new-target)
+    (define-key map ".s" 'ede-speedbar)
+    (define-key map ".C" 'ede-compile-project)
+    (define-key map ".d" 'ede-make-dist)
 
-(defvar ede-dired-keymap nil
+    (easy-menu-define
+      ede-dired-menu map "EDE Dired Minor Mode Menu"
+      '("Project"
+        [ "Add files to target" ede-dired-add-to-target (ede-current-project) ]
+        ( "Build" :filter ede-build-forms-menu)
+        "-"
+        [ "Create Project" ede-new (not (ede-current-project)) ]
+        [ "Create Target" ede-new-target (ede-current-project) ]
+        "-"
+        ( "Customize Project" :filter ede-customize-forms-menu )
+        [ "View Project Tree" ede-speedbar (ede-current-project) ]
+        ))
+    map)
   "Keymap used for ede dired minor mode.")
 
-(if ede-dired-keymap
-    nil
-  (setq ede-dired-keymap (make-sparse-keymap))
-  (define-key ede-dired-keymap ".a" 'ede-dired-add-to-target)
-  (define-key ede-dired-keymap ".t" 'ede-new-target)
-  (define-key ede-dired-keymap ".s" 'ede-speedbar)
-  (define-key ede-dired-keymap ".C" 'ede-compile-project)
-  (define-key ede-dired-keymap ".d" 'ede-make-dist)
-
-  (easy-menu-define
-   ede-dired-menu ede-dired-keymap "EDE Dired Minor Mode Menu"
-   '("Project"
-     [ "Add files to target" ede-dired-add-to-target (ede-current-project) ]
-     ( "Build" :filter ede-build-forms-menu)
-     "-"
-     [ "Create Project" ede-new (not (ede-current-project)) ]
-     [ "Create Target" ede-new-target (ede-current-project) ]
-     "-"
-     ( "Customize Project" :filter ede-customize-forms-menu )
-     [ "View Project Tree" ede-speedbar (ede-current-project) ]
-     ))
-  )
-
-(defun ede-dired-minor-mode (&optional arg)
+(define-minor-mode ede-dired-minor-mode
   "A minor mode that should only be activated in DIRED buffers.
-If ARG is nil, toggle, if it is a positive number, force on, if
+If ARG is nil or a positive number, force on, if
 negative, force off."
-  (interactive "P")
-  (if (not (or (eq major-mode 'dired-mode)
-	       (eq major-mode 'vc-dired-mode)))
-      (error "Not in DIRED mode"))
-  (setq ede-dired-minor-mode
-	(not (or (and (null arg) ede-dired-minor-mode)
-		 (<= (prefix-numeric-value arg) 0))))
-  (if (and (not (ede-directory-project-p default-directory))
-	   (not (interactive-p)))
-      (setq ede-dired-minor-mode nil))
-  )
+  :lighter " EDE" :keymap ede-dired-keymap
+  (unless (derived-mode-p 'dired-mode)
+    (setq ede-dired-minor-mode nil)
+    (error "Not in DIRED mode"))
+  (unless (or (ede-directory-project-p default-directory)
+              (interactive-p))
+    (setq ede-dired-minor-mode nil)))
 
 (defun ede-dired-add-to-target (target)
   "Add a file, or all marked files into a TARGET."
@@ -85,24 +74,13 @@
 		(let ((ede-object (ede-current-project)))
 		  (ede-invoke-method 'project-interactive-select-target
 				     "Add files to Target: "))))
-  (let ((files (dired-get-marked-files t)))
-    (while files
-      (project-add-file target (car files))
-      ;; Find the buffer for this files, and set it's ede-object
-      (if (get-file-buffer (car files))
-	  (with-current-buffer (get-file-buffer (car files))
-	    (setq ede-object nil)
-	    (setq ede-object (ede-buffer-object (current-buffer)))))
-      ;; Increment.
-      (setq files (cdr files)))))
-
-;; Minor mode management.
-(add-to-list 'minor-mode-alist '(ede-dired-minor-mode " EDE"))
-(let ((a (assoc 'ede-dired-minor-mode minor-mode-map-alist)))
-  (if a
-      (setcdr a ede-dired-keymap)
-    (add-to-list 'minor-mode-map-alist (cons 'ede-dired-minor-mode
-					     ede-dired-keymap))))
+  (dolist (file (dired-get-marked-files t))
+    (project-add-file target file)
+    ;; Find the buffer for this files, and set it's ede-object
+    (if (get-file-buffer file)
+        (with-current-buffer (get-file-buffer file)
+          (setq ede-object nil)
+          (setq ede-object (ede-buffer-object (current-buffer)))))))
 
 (provide 'ede/dired)
 
--- a/lisp/cedet/semantic/decorate/mode.el	Sat May 01 22:39:50 2010 -0400
+++ b/lisp/cedet/semantic/decorate/mode.el	Sat May 01 23:38:19 2010 -0400
@@ -224,46 +224,34 @@
 ;; Generic mode for handling basic highlighting and decorations.
 ;;
 
-(defcustom global-semantic-decoration-mode nil
-  "*If non-nil, enable global use of command `semantic-decoration-mode'.
-When this mode is activated, decorations specified by
-`semantic-decoration-styles'."
-  :group 'semantic
-  :group 'semantic-modes
-  :type 'boolean
-  :require 'semantic/decorate/mode
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-decoration-mode (if val 1 -1))))
-
 ;;;###autoload
-(defun global-semantic-decoration-mode (&optional arg)
+(define-minor-mode global-semantic-decoration-mode
   "Toggle global use of option `semantic-decoration-mode'.
 Decoration mode turns on all active decorations as specified
-by `semantic-decoration-styles'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-semantic-decoration-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-decoration-mode arg)))
+by `semantic-decoration-styles'."
+  :global t :group 'semantic :group 'semantic-modes
+  ;; Not needed because it's autoloaded instead.
+  ;; :require 'semantic/decorate/mode
+  (semantic-toggle-minor-mode-globally
+   'semantic-decoration-mode (if global-semantic-decoration-mode 1 -1)))
 
 (defcustom semantic-decoration-mode-hook nil
   "Hook run at the end of function `semantic-decoration-mode'."
   :group 'semantic
   :type 'hook)
 
-;;;;###autoload
-(defvar semantic-decoration-mode nil
-  "Non-nil if command `semantic-decoration-mode' is enabled.
-Use the command `semantic-decoration-mode' to change this variable.")
-(make-variable-buffer-local 'semantic-decoration-mode)
-
-(defun semantic-decoration-mode-setup ()
-  "Setup the `semantic-decoration-mode' minor mode.
-The minor mode can be turned on only if the semantic feature is available
-and the current buffer was set up for parsing.  Return non-nil if the
+(define-minor-mode semantic-decoration-mode
+  "Minor mode for decorating tags.
+Decorations are specified in `semantic-decoration-styles'.
+You can define new decoration styles with
+`define-semantic-decoration-style'.
+With prefix argument ARG, turn on if positive, otherwise off.  The
+minor mode can be turned on only if semantic feature is available and
+the current buffer was set up for parsing.  Return non-nil if the
 minor mode is enabled."
+;;
+;;\\{semantic-decoration-map}"
+  nil nil nil
   (if semantic-decoration-mode
       (if (not (and (featurep 'semantic) (semantic-active-p)))
           (progn
@@ -280,8 +268,7 @@
                   'semantic-decorate-tags-after-full-reparse nil t)
         ;; Add decorations to available tags.  The above hooks ensure
         ;; that new tags will be decorated when they become available.
-        (semantic-decorate-add-decorations (semantic-fetch-available-tags))
-        )
+        (semantic-decorate-add-decorations (semantic-fetch-available-tags)))
     ;; Remove decorations from available tags.
     (semantic-decorate-clear-decorations (semantic-fetch-available-tags))
     ;; Cleanup any leftover crap too.
@@ -290,41 +277,11 @@
     (remove-hook 'semantic-after-partial-cache-change-hook
                  'semantic-decorate-tags-after-partial-reparse t)
     (remove-hook 'semantic-after-toplevel-cache-change-hook
-                 'semantic-decorate-tags-after-full-reparse t)
-    )
-  semantic-decoration-mode)
-
-(defun semantic-decoration-mode (&optional arg)
-  "Minor mode for decorating tags.
-Decorations are specified in `semantic-decoration-styles'.
-You can define new decoration styles with
-`define-semantic-decoration-style'.
-With prefix argument ARG, turn on if positive, otherwise off.  The
-minor mode can be turned on only if semantic feature is available and
-the current buffer was set up for parsing.  Return non-nil if the
-minor mode is enabled."
-;;
-;;\\{semantic-decoration-map}"
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-decoration-mode 0 1))))
-  (setq semantic-decoration-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-decoration-mode)))
-  (semantic-decoration-mode-setup)
-  (run-hooks 'semantic-decoration-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "decoration-mode minor mode %sabled"
-               (if semantic-decoration-mode "en" "dis")))
-  (semantic-mode-line-update)
-  semantic-decoration-mode)
+                 'semantic-decorate-tags-after-full-reparse t))
+  (semantic-mode-line-update))
 
 (semantic-add-minor-mode 'semantic-decoration-mode
-                         ""
-                         nil)
+                         "")
 
 (defun semantic-decorate-tags-after-full-reparse (tag-list)
   "Add decorations after a complete reparse of the current buffer.
--- a/lisp/cedet/semantic/idle.el	Sat May 01 22:39:50 2010 -0400
+++ b/lisp/cedet/semantic/idle.el	Sat May 01 23:38:19 2010 -0400
@@ -128,16 +128,6 @@
 ;; The minor mode portion of this code just sets up the minor mode
 ;; which does the initial scheduling of the idle timers.
 ;;
-;;;###autoload
-(defcustom global-semantic-idle-scheduler-mode nil
-  "*If non-nil, enable global use of idle-scheduler mode."
-  :group 'semantic
-  :group 'semantic-modes
-  :type 'boolean
-  :require 'semantic/idle
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-idle-scheduler-mode (if val 1 -1))))
 
 (defcustom semantic-idle-scheduler-mode-hook nil
   "Hook run at the end of the function `semantic-idle-scheduler-mode'."
@@ -167,24 +157,8 @@
        (or (<= semantic-idle-scheduler-max-buffer-size 0)
 	   (< (buffer-size) semantic-idle-scheduler-max-buffer-size))))
 
-(defun semantic-idle-scheduler-mode-setup ()
-  "Setup option `semantic-idle-scheduler-mode'.
-The minor mode can be turned on only if semantic feature is available
-and the current buffer was set up for parsing.  When minor mode is
-enabled parse the current buffer if needed.  Return non-nil if the
-minor mode is enabled."
-  (if semantic-idle-scheduler-mode
-      (if (not (and (featurep 'semantic) (semantic-active-p)))
-          (progn
-            ;; Disable minor mode if semantic stuff not available
-            (setq semantic-idle-scheduler-mode nil)
-            (error "Buffer %s was not set up idle time scheduling"
-                   (buffer-name)))
-        (semantic-idle-scheduler-setup-timers)))
-  semantic-idle-scheduler-mode)
-
 ;;;###autoload
-(defun semantic-idle-scheduler-mode (&optional arg)
+(define-minor-mode semantic-idle-scheduler-mode
   "Minor mode to auto parse buffer following a change.
 When this mode is off, a buffer is only rescanned for tokens when
 some command requests the list of available tokens.  When idle-scheduler
@@ -195,26 +169,19 @@
 minor mode can be turned on only if semantic feature is available and
 the current buffer was set up for parsing.  Return non-nil if the
 minor mode is enabled."
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-idle-scheduler-mode 0 1))))
-  (setq semantic-idle-scheduler-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-idle-scheduler-mode)))
-  (semantic-idle-scheduler-mode-setup)
-  (run-hooks 'semantic-idle-scheduler-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "idle-scheduler minor mode %sabled"
-               (if semantic-idle-scheduler-mode "en" "dis")))
-  (semantic-mode-line-update)
-  semantic-idle-scheduler-mode)
+  nil nil nil
+  (if semantic-idle-scheduler-mode
+      (if (not (and (featurep 'semantic) (semantic-active-p)))
+          (progn
+            ;; Disable minor mode if semantic stuff not available
+            (setq semantic-idle-scheduler-mode nil)
+            (error "Buffer %s was not set up idle time scheduling"
+                   (buffer-name)))
+        (semantic-idle-scheduler-setup-timers)))
+  (semantic-mode-line-update))
 
 (semantic-add-minor-mode 'semantic-idle-scheduler-mode
-                         "ARP"
-                         nil)
+                         "ARP")
 
 ;;; SERVICES services
 ;;
@@ -582,31 +549,23 @@
 	(mode 	(intern (concat (symbol-name name) "-mode")))
 	(hook 	(intern (concat (symbol-name name) "-mode-hook")))
 	(map  	(intern (concat (symbol-name name) "-mode-map")))
-	(setup 	(intern (concat (symbol-name name) "-mode-setup")))
 	(func 	(intern (concat (symbol-name name) "-idle-function"))))
 
     `(eval-and-compile
-       (defun ,global (&optional arg)
+       (define-minor-mode ,global
 	 ,(concat "Toggle " (symbol-name global) ".
 With ARG, turn the minor mode on if ARG is positive, off otherwise.
 
 When this minor mode is enabled, `" (symbol-name mode) "' is
 turned on in every Semantic-supported buffer.")
-	 (interactive "P")
-	 (setq ,global
-	       (semantic-toggle-minor-mode-globally
-		',mode arg)))
-
-       (defcustom ,global nil
-	 ,(concat "Non-nil if `" (symbol-name mode) "' is enabled.")
+         :global t
 	 :group 'semantic
 	 :group 'semantic-modes
-	 :type 'boolean
 	 :require 'semantic/idle
-	 :initialize 'custom-initialize-default
-	 :set (lambda (sym val)
-		(,global (if val 1 -1))))
+	 (semantic-toggle-minor-mode-globally
+	  ',mode (if ,global 1 -1)))
 
+       ;; FIXME: Get rid of this when define-minor-mode does it for us.
        (defcustom ,hook nil
 	 ,(concat "Hook run at the end of function `" (symbol-name mode) "'.")
 	 :group 'semantic
@@ -617,14 +576,9 @@
 	   km)
 	 ,(concat "Keymap for `" (symbol-name mode) "'."))
 
-       (defvar ,mode nil
-	 ,(concat "Non-nil if the minor mode `" (symbol-name mode) "' is enabled.
-Use the command `" (symbol-name mode) "' to change this variable."))
-       (make-variable-buffer-local ',mode)
-
-       (defun ,setup ()
-	 ,(concat "Set up `" (symbol-name mode) "'.
-Return non-nil if the minor mode is enabled.")
+       (define-minor-mode ,mode
+	 ,doc
+         :keymap ,map
 	 (if ,mode
 	     (if (not (and (featurep 'semantic) (semantic-active-p)))
 		 (progn
@@ -633,36 +587,13 @@
 		   (error "Buffer %s was not set up for parsing"
 			  (buffer-name)))
 	       ;; Enable the mode mode
-	       (semantic-idle-scheduler-add #',func)
-	       )
+	       (semantic-idle-scheduler-add #',func))
 	   ;; Disable the mode mode
-	   (semantic-idle-scheduler-remove #',func)
-	   )
-	 ,mode)
-
-       (defun ,mode (&optional arg)
-	 ,doc
-	 (interactive
-	  (list (or current-prefix-arg
-		    (if ,mode 0 1))))
-	 (setq ,mode
-	       (if arg
-		   (>
-		    (prefix-numeric-value arg)
-		    0)
-		 (not ,mode)))
-	 (,setup)
-	 (run-hooks ,hook)
-	 (if (called-interactively-p 'interactive)
-	     (message "%s %sabled"
-		      (symbol-name ',mode)
-		      (if ,mode "en" "dis")))
-	 (semantic-mode-line-update)
-	 ,mode)
+	   (semantic-idle-scheduler-remove #',func))
+         (semantic-mode-line-update))
 
        (semantic-add-minor-mode ',mode
-				""	; idle schedulers are quiet?
-				,map)
+				"")	; idle schedulers are quiet?
 
        (defun ,func ()
 	 ,(concat "Perform idle activity for the minor mode `"
@@ -814,21 +745,6 @@
 of the lexical token at point whenever Emacs is idle."
   :group 'semantic
   :group 'semantic-modes
-  (semantic-idle-summary-mode-setup)
-  (semantic-mode-line-update))
-
-(defun semantic-idle-summary-refresh-echo-area ()
-  (and semantic-idle-summary-mode
-       eldoc-last-message
-       (if (and (not executing-kbd-macro)
-		(not (and (boundp 'edebug-active) edebug-active))
-		(not cursor-in-echo-area)
-		(not (eq (selected-window) (minibuffer-window))))
-           (eldoc-message eldoc-last-message)
-         (setq eldoc-last-message nil))))
-
-(defun semantic-idle-summary-mode-setup ()
-  "Set up `semantic-idle-summary-mode'."
   (if semantic-idle-summary-mode
       ;; Enable the mode
       (progn
@@ -843,7 +759,17 @@
     ;; Disable the mode
     (semantic-idle-scheduler-remove 'semantic-idle-summary-idle-function)
     (remove-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t))
-  semantic-idle-summary-mode)
+  (semantic-mode-line-update))
+
+(defun semantic-idle-summary-refresh-echo-area ()
+  (and semantic-idle-summary-mode
+       eldoc-last-message
+       (if (and (not executing-kbd-macro)
+		(not (and (boundp 'edebug-active) edebug-active))
+		(not cursor-in-echo-area)
+		(not (eq (selected-window) (minibuffer-window))))
+           (eldoc-message eldoc-last-message)
+         (setq eldoc-last-message nil))))
 
 (semantic-add-minor-mode 'semantic-idle-summary-mode "")
 
@@ -957,22 +883,22 @@
 
 
 ;;;###autoload
-(defun global-semantic-idle-scheduler-mode (&optional arg)
+(define-minor-mode global-semantic-idle-scheduler-mode
   "Toggle global use of option `semantic-idle-scheduler-mode'.
 The idle scheduler will automatically reparse buffers in idle time,
 and then schedule other jobs setup with `semantic-idle-scheduler-add'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t
+  :group 'semantic
+  :group 'semantic-modes
   ;; When turning off, disable other idle modes.
-  (when (or (and (numberp arg) (< arg 0))
-	    (and (null arg) global-semantic-idle-scheduler-mode))
+  (when (null global-semantic-idle-scheduler-mode)
     (global-semantic-idle-summary-mode -1)
     (global-semantic-idle-tag-highlight-mode -1)
     (global-semantic-idle-completions-mode -1))
-  (setq global-semantic-idle-scheduler-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-idle-scheduler-mode arg)))
+  (semantic-toggle-minor-mode-globally
+   'semantic-idle-scheduler-mode
+   (if global-semantic-idle-scheduler-mode 1 -1)))
 
 
 ;;; Completion Popup Mode
--- a/lisp/cedet/semantic/mru-bookmark.el	Sat May 01 22:39:50 2010 -0400
+++ b/lisp/cedet/semantic/mru-bookmark.el	Sat May 01 23:38:19 2010 -0400
@@ -239,27 +239,15 @@
 ;;
 ;; Tracking minor mode.
 
-(defcustom global-semantic-mru-bookmark-mode nil
-  "If non-nil, enable `semantic-mru-bookmark-mode' globally.
-When this mode is enabled, Emacs keeps track of which tags have
-been edited, and you can re-visit them with \\[semantic-mrub-switch-tags]."
-  :group 'semantic
-  :group 'semantic-modes
-  :type 'boolean
-  :require 'semantic-util-modes
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-mru-bookmark-mode (if val 1 -1))))
-
 ;;;###autoload
-(defun global-semantic-mru-bookmark-mode (&optional arg)
+(define-minor-mode global-semantic-mru-bookmark-mode
   "Toggle global use of option `semantic-mru-bookmark-mode'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-semantic-mru-bookmark-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-mru-bookmark-mode arg)))
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t :group 'semantic :group 'semantic-modes
+  ;; Not needed because it's autoloaded instead.
+  ;; :require 'semantic-util-modes
+  (semantic-toggle-minor-mode-globally
+   'semantic-mru-bookmark-mode (if global-semantic-mru-bookmark-mode 1 -1)))
 
 (defcustom semantic-mru-bookmark-mode-hook nil
   "*Hook run at the end of function `semantic-mru-bookmark-mode'."
@@ -272,17 +260,18 @@
     km)
   "Keymap for mru-bookmark minor mode.")
 
-(defvar semantic-mru-bookmark-mode nil
-  "Non-nil if mru-bookmark minor mode is enabled.
-Use the command `semantic-mru-bookmark-mode' to change this variable.")
-(make-variable-buffer-local 'semantic-mru-bookmark-mode)
+(define-minor-mode semantic-mru-bookmark-mode
+  "Minor mode for tracking tag-based bookmarks automatically.
+When this mode is enabled, Emacs keeps track of which tags have
+been edited, and you can re-visit them with \\[semantic-mrub-switch-tags].
 
-(defun semantic-mru-bookmark-mode-setup ()
-  "Setup option `semantic-mru-bookmark-mode'.
-The minor mode can be turned on only if semantic feature is available
-and the current buffer was set up for parsing.  When minor mode is
-enabled parse the current buffer if needed.  Return non-nil if the
+\\{semantic-mru-bookmark-mode-map}
+
+With prefix argument ARG, turn on if positive, otherwise off.  The
+minor mode can be turned on only if semantic feature is available and
+the current buffer was set up for parsing.  Return non-nil if the
 minor mode is enabled."
+  :keymap semantic-mru-bookmark-mode-map
   (if semantic-mru-bookmark-mode
       (if (not (and (featurep 'semantic) (semantic-active-p)))
 	  (progn
@@ -294,47 +283,16 @@
         (add-hook 'semantic-edits-new-change-hooks
                   'semantic-mru-bookmark-change-hook-fcn nil t)
         (add-hook 'semantic-edits-move-change-hooks
-                  'semantic-mru-bookmark-change-hook-fcn nil t)
-        )
+                  'semantic-mru-bookmark-change-hook-fcn nil t))
     ;; Remove hooks
     (remove-hook 'semantic-edits-new-change-hooks
 		 'semantic-mru-bookmark-change-hook-fcn t)
     (remove-hook 'semantic-edits-move-change-hooks
-		 'semantic-mru-bookmark-change-hook-fcn t)
-    )
-  semantic-mru-bookmark-mode)
-
-(defun semantic-mru-bookmark-mode (&optional arg)
-  "Minor mode for tracking tag-based bookmarks automatically.
-When this mode is enabled, Emacs keeps track of which tags have
-been edited, and you can re-visit them with \\[semantic-mrub-switch-tags].
-
-\\{semantic-mru-bookmark-mode-map}
-
-With prefix argument ARG, turn on if positive, otherwise off.  The
-minor mode can be turned on only if semantic feature is available and
-the current buffer was set up for parsing.  Return non-nil if the
-minor mode is enabled."
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-mru-bookmark-mode 0 1))))
-  (setq semantic-mru-bookmark-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-mru-bookmark-mode)))
-  (semantic-mru-bookmark-mode-setup)
-  (run-hooks 'semantic-mru-bookmark-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "mru-bookmark minor mode %sabled"
-               (if semantic-mru-bookmark-mode "en" "dis")))
-  (semantic-mode-line-update)
-  semantic-mru-bookmark-mode)
+		 'semantic-mru-bookmark-change-hook-fcn t))
+  (semantic-mode-line-update))
 
 (semantic-add-minor-mode 'semantic-mru-bookmark-mode
-                         "k"
-                         semantic-mru-bookmark-mode-map)
+                         "k")
 
 ;;; COMPLETING READ
 ;;
--- a/lisp/cedet/semantic/util-modes.el	Sat May 01 22:39:50 2010 -0400
+++ b/lisp/cedet/semantic/util-modes.el	Sat May 01 23:38:19 2010 -0400
@@ -112,7 +112,7 @@
 BUFFER is the buffer to not initialize a Semantic minor mode in."
   nil)
 
-(defun semantic-add-minor-mode (toggle name &optional keymap)
+(defun semantic-add-minor-mode (toggle name)
   "Register a new Semantic minor mode.
 TOGGLE is a symbol which is the name of a buffer-local variable that
 is toggled on or off to say whether the minor mode is active or not.
@@ -120,25 +120,12 @@
 
 NAME specifies what will appear in the mode line when the minor mode
 is active.  NAME should be either a string starting with a space, or a
-symbol whose value is such a string.
-
-Optional KEYMAP is the keymap for the minor mode that will be added to
-`minor-mode-map-alist'."
+symbol whose value is such a string."
   ;; Add a dymmy semantic minor mode to display the status
   (or (assq 'semantic-minor-modes-status minor-mode-alist)
       (setq minor-mode-alist (cons (list 'semantic-minor-modes-status
                                          'semantic-minor-modes-status)
                                    minor-mode-alist)))
-  (if (fboundp 'add-minor-mode)
-      ;; Emacs 21 & XEmacs
-      (add-minor-mode toggle "" keymap)
-    ;; Emacs 20
-    (or (assq toggle minor-mode-alist)
-        (setq minor-mode-alist (cons (list toggle "") minor-mode-alist)))
-    (or (not keymap)
-        (assq toggle minor-mode-map-alist)
-        (setq minor-mode-map-alist (cons (cons toggle keymap)
-                                         minor-mode-map-alist))))
   ;; Record how to display this minor mode in the mode line
   (let ((mm (assq toggle semantic-minor-mode-alist)))
     (if mm
@@ -157,61 +144,36 @@
 (defun semantic-toggle-minor-mode-globally (mode &optional arg)
   "Toggle minor mode MODE in every Semantic enabled buffer.
 Return non-nil if MODE is turned on in every Semantic enabled buffer.
-If ARG is positive, enable, if it is negative, disable.  If ARG is
-nil, then toggle.  Otherwise do nothing.  MODE must be a valid minor
-mode defined in `minor-mode-alist' and must be too an interactive
-function used to toggle the mode."
+If ARG is positive, enable, if it is negative, disable.
+MODE must be a valid minor mode defined in `minor-mode-alist' and must be
+too an interactive function used to toggle the mode."
+  ;; FIXME: All callers should pass a -1 or +1 argument.
   (or (and (fboundp mode) (assq mode minor-mode-alist))
       (error "Semantic minor mode %s not found" mode))
-  (if (not arg)
-      (if (memq mode semantic-init-hook)
-	  (setq arg -1)
-	(setq arg 1)))
-  ;; Add or remove the MODE toggle function from
-  ;; `semantic-init-hook'.  Then turn MODE on or off in every
-  ;; Semantic enabled buffer.
+  ;; Add or remove the MODE toggle function from `semantic-init-hook'.
   (cond
    ;; Turn off if ARG < 0
-   ((< arg 0)
-    (remove-hook 'semantic-init-hook mode)
-    (semantic-map-buffers #'(lambda () (funcall mode -1)))
-    nil)
+   ((< arg 0) (remove-hook 'semantic-init-hook mode))
    ;; Turn on if ARG > 0
-   ((> arg 0)
-    (add-hook 'semantic-init-hook mode)
-    (semantic-map-buffers #'(lambda () (funcall mode 1)))
-    t)
+   ((> arg 0) (add-hook 'semantic-init-hook mode))
    ;; Otherwise just check MODE state
    (t
-    (memq mode semantic-init-hook))
-   ))
+    (error "semantic-toggle-minor-mode-globally: arg should be -1 or 1")))
+  ;; Then turn MODE on or off in every Semantic enabled buffer.
+  (semantic-map-buffers #'(lambda () (funcall mode arg))))
 
 ;;;;
 ;;;; Minor mode to highlight areas that a user edits.
 ;;;;
 
 ;;;###autoload
-(defun global-semantic-highlight-edits-mode (&optional arg)
+(define-minor-mode global-semantic-highlight-edits-mode
   "Toggle global use of option `semantic-highlight-edits-mode'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-semantic-highlight-edits-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-highlight-edits-mode arg)))
-
-;;;###autoload
-(defcustom global-semantic-highlight-edits-mode nil
-  "If non-nil enable global use of variable `semantic-highlight-edits-mode'.
-When this mode is enabled, changes made to a buffer are highlighted
-until the buffer is reparsed."
-  :group 'semantic
-  :group 'semantic-modes
-  :type 'boolean
-  :require 'semantic/util-modes
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-highlight-edits-mode (if val 1 -1))))
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t :group 'semantic :group 'semantic-modes
+  (semantic-toggle-minor-mode-globally
+   'semantic-highlight-edits-mode
+   (if global-semantic-highlight-edits-mode 1 -1)))
 
 (defcustom semantic-highlight-edits-mode-hook nil
   "Hook run at the end of function `semantic-highlight-edits-mode'."
@@ -238,36 +200,8 @@
     km)
   "Keymap for highlight-edits minor mode.")
 
-(defvar semantic-highlight-edits-mode nil
-  "Non-nil if highlight-edits minor mode is enabled.
-Use the command `semantic-highlight-edits-mode' to change this variable.")
-(make-variable-buffer-local 'semantic-highlight-edits-mode)
-
-(defun semantic-highlight-edits-mode-setup ()
-  "Setup option `semantic-highlight-edits-mode'.
-The minor mode can be turned on only if semantic feature is available
-and the current buffer was set up for parsing.  When minor mode is
-enabled parse the current buffer if needed.  Return non-nil if the
-minor mode is enabled."
-  (if semantic-highlight-edits-mode
-      (if (not (and (featurep 'semantic) (semantic-active-p)))
-	  (progn
-	    ;; Disable minor mode if semantic stuff not available
-	    (setq semantic-highlight-edits-mode nil)
-	    (error "Buffer %s was not set up for parsing"
-		   (buffer-name)))
-	(semantic-make-local-hook 'semantic-edits-new-change-hooks)
-	(add-hook 'semantic-edits-new-change-hooks
-		  'semantic-highlight-edits-new-change-hook-fcn nil t)
-	)
-    ;; Remove hooks
-    (remove-hook 'semantic-edits-new-change-hooks
-		 'semantic-highlight-edits-new-change-hook-fcn t)
-    )
-  semantic-highlight-edits-mode)
-
 ;;;###autoload
-(defun semantic-highlight-edits-mode (&optional arg)
+(define-minor-mode semantic-highlight-edits-mode
   "Minor mode for highlighting changes made in a buffer.
 Changes are tracked by semantic so that the incremental parser can work
 properly.
@@ -277,54 +211,39 @@
 minor mode can be turned on only if semantic feature is available and
 the current buffer was set up for parsing.  Return non-nil if the
 minor mode is enabled."
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-highlight-edits-mode 0 1))))
-  (setq semantic-highlight-edits-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-highlight-edits-mode)))
-  (semantic-highlight-edits-mode-setup)
-  (run-hooks 'semantic-highlight-edits-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "highlight-edits minor mode %sabled"
-               (if semantic-highlight-edits-mode "en" "dis")))
-  (semantic-mode-line-update)
-  semantic-highlight-edits-mode)
+  :keymap semantic-highlight-edits-mode-map
+  (if semantic-highlight-edits-mode
+      (if (not (and (featurep 'semantic) (semantic-active-p)))
+	  (progn
+	    ;; Disable minor mode if semantic stuff not available
+	    (setq semantic-highlight-edits-mode nil)
+	    (error "Buffer %s was not set up for parsing"
+		   (buffer-name)))
+	(semantic-make-local-hook 'semantic-edits-new-change-hooks)
+	(add-hook 'semantic-edits-new-change-hooks
+		  'semantic-highlight-edits-new-change-hook-fcn nil t))
+    ;; Remove hooks
+    (remove-hook 'semantic-edits-new-change-hooks
+		 'semantic-highlight-edits-new-change-hook-fcn t))
+  (semantic-mode-line-update))
 
 (semantic-add-minor-mode 'semantic-highlight-edits-mode
-                         "e"
-                         semantic-highlight-edits-mode-map)
-
+                         "e")
 
 ;;;;
 ;;;; Minor mode to show unmatched-syntax elements
 ;;;;
 
 ;;;###autoload
-(defun global-semantic-show-unmatched-syntax-mode (&optional arg)
+(define-minor-mode global-semantic-show-unmatched-syntax-mode
   "Toggle global use of option `semantic-show-unmatched-syntax-mode'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-semantic-show-unmatched-syntax-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-show-unmatched-syntax-mode arg)))
-
-;;;###autoload
-(defcustom global-semantic-show-unmatched-syntax-mode nil
-  "If non-nil, enable global use of `semantic-show-unmatched-syntax-mode'.
-When this mode is enabled, syntax in the current buffer which the
-semantic parser cannot match is highlighted with a red underline."
-  :group 'semantic
-  :group 'semantic-modes
-  :type 'boolean
-  :require 'semantic/util-modes
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-show-unmatched-syntax-mode (if val 1 -1))))
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t :group 'semantic :group 'semantic-modes
+  ;; Not needed because it's autoloaded instead.
+  ;; :require 'semantic/util-modes
+  (semantic-toggle-minor-mode-globally
+   'semantic-show-unmatched-syntax-mode
+   (if global-semantic-show-unmatched-syntax-mode 1 -1)))
 
 (defcustom semantic-show-unmatched-syntax-mode-hook nil
   "Hook run at the end of function `semantic-show-unmatched-syntax-mode'."
@@ -432,18 +351,21 @@
     km)
   "Keymap for command `semantic-show-unmatched-syntax-mode'.")
 
-(defvar semantic-show-unmatched-syntax-mode nil
-  "Non-nil if show-unmatched-syntax minor mode is enabled.
-Use the command `semantic-show-unmatched-syntax-mode' to change this
-variable.")
-(make-variable-buffer-local 'semantic-show-unmatched-syntax-mode)
+;;;###autoload
+(define-minor-mode semantic-show-unmatched-syntax-mode
+  "Minor mode to highlight unmatched lexical syntax tokens.
+When a parser executes, some elements in the buffer may not match any
+parser rules.  These text characters are considered unmatched syntax.
+Often time, the display of unmatched syntax can expose coding
+problems before the compiler is run.
 
-(defun semantic-show-unmatched-syntax-mode-setup ()
-  "Setup the `semantic-show-unmatched-syntax' minor mode.
-The minor mode can be turned on only if semantic feature is available
-and the current buffer was set up for parsing.  When minor mode is
-enabled parse the current buffer if needed.  Return non-nil if the
-minor mode is enabled."
+With prefix argument ARG, turn on if positive, otherwise off.  The
+minor mode can be turned on only if semantic feature is available and
+the current buffer was set up for parsing.  Return non-nil if the
+minor mode is enabled.
+
+\\{semantic-show-unmatched-syntax-mode-map}"
+  :keymap semantic-show-unmatched-syntax-mode-map
   (if semantic-show-unmatched-syntax-mode
       (if (not (and (featurep 'semantic) (semantic-active-p)))
           (progn
@@ -469,42 +391,10 @@
 		 'semantic-clean-token-of-unmatched-syntax t)
     ;; Cleanup unmatched-syntax highlighting
     (semantic-clean-unmatched-syntax-in-buffer))
-  semantic-show-unmatched-syntax-mode)
-
-;;;###autoload
-(defun semantic-show-unmatched-syntax-mode (&optional arg)
-  "Minor mode to highlight unmatched lexical syntax tokens.
-When a parser executes, some elements in the buffer may not match any
-parser rules.  These text characters are considered unmatched syntax.
-Often time, the display of unmatched syntax can expose coding
-problems before the compiler is run.
-
-With prefix argument ARG, turn on if positive, otherwise off.  The
-minor mode can be turned on only if semantic feature is available and
-the current buffer was set up for parsing.  Return non-nil if the
-minor mode is enabled.
-
-\\{semantic-show-unmatched-syntax-mode-map}"
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-show-unmatched-syntax-mode 0 1))))
-  (setq semantic-show-unmatched-syntax-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-show-unmatched-syntax-mode)))
-  (semantic-show-unmatched-syntax-mode-setup)
-  (run-hooks 'semantic-show-unmatched-syntax-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "show-unmatched-syntax minor mode %sabled"
-               (if semantic-show-unmatched-syntax-mode "en" "dis")))
-  (semantic-mode-line-update)
-  semantic-show-unmatched-syntax-mode)
+  (semantic-mode-line-update))
 
 (semantic-add-minor-mode 'semantic-show-unmatched-syntax-mode
-                         "u"
-                         semantic-show-unmatched-syntax-mode-map)
+                         "u")
 
 (defun semantic-show-unmatched-syntax-next ()
   "Move forward to the next occurrence of unmatched syntax."
@@ -519,27 +409,15 @@
 ;;;;
 
 ;;;###autoload
-(defcustom global-semantic-show-parser-state-mode nil
-  "If non-nil enable global use of `semantic-show-parser-state-mode'.
-When enabled, the current parse state of the current buffer is displayed
-in the mode line.  See `semantic-show-parser-state-marker' for details
-on what is displayed."
-  :group 'semantic
-  :type 'boolean
-  :require 'semantic/util-modes
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-show-parser-state-mode (if val 1 -1))))
-
-;;;###autoload
-(defun global-semantic-show-parser-state-mode (&optional arg)
+(define-minor-mode global-semantic-show-parser-state-mode
   "Toggle global use of option `semantic-show-parser-state-mode'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-semantic-show-parser-state-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-show-parser-state-mode arg)))
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t :group 'semantic
+  ;; Not needed because it's autoloaded instead.
+  ;; :require 'semantic/util-modes
+  (semantic-toggle-minor-mode-globally
+   'semantic-show-parser-state-mode
+   (if global-semantic-show-parser-state-mode 1 -1)))
 
 (defcustom semantic-show-parser-state-mode-hook nil
   "Hook run at the end of function `semantic-show-parser-state-mode'."
@@ -551,17 +429,22 @@
     km)
   "Keymap for show-parser-state minor mode.")
 
-(defvar semantic-show-parser-state-mode nil
-  "Non-nil if show-parser-state minor mode is enabled.
-Use the command `semantic-show-parser-state-mode' to change this variable.")
-(make-variable-buffer-local 'semantic-show-parser-state-mode)
-
-(defun semantic-show-parser-state-mode-setup ()
-  "Setup option `semantic-show-parser-state-mode'.
-The minor mode can be turned on only if semantic feature is available
-and the current buffer was set up for parsing.  When minor mode is
-enabled parse the current buffer if needed.  Return non-nil if the
+;;;###autoload
+(define-minor-mode semantic-show-parser-state-mode
+  "Minor mode for displaying parser cache state in the modeline.
+The cache can be in one of three states.  They are
+Up to date, Partial reparse needed, and Full reparse needed.
+The state is indicated in the modeline with the following characters:
+ `-'  ->  The cache is up to date.
+ `!'  ->  The cache requires a full update.
+ `~'  ->  The cache needs to be incrementally parsed.
+ `%'  ->  The cache is not currently parseable.
+ `@'  ->  Auto-parse in progress (not set here.)
+With prefix argument ARG, turn on if positive, otherwise off.  The
+minor mode can be turned on only if semantic feature is available and
+the current buffer was set up for parsing.  Return non-nil if the
 minor mode is enabled."
+  :keymap semantic-show-parser-state-mode-map
   (if semantic-show-parser-state-mode
       (if (not (and (featurep 'semantic) (semantic-active-p)))
           (progn
@@ -603,8 +486,7 @@
 		  'semantic-show-parser-state-auto-marker nil t)
 	(semantic-make-local-hook 'semantic-after-idle-scheduler-reparse-hook)
 	(add-hook 'semantic-after-idle-scheduler-reparse-hook
-		  'semantic-show-parser-state-marker nil t)
-        )
+		  'semantic-show-parser-state-marker nil t))
     ;; Remove parts of mode line
     (setq mode-line-modified
 	  (delq 'semantic-show-parser-state-string mode-line-modified))
@@ -626,45 +508,11 @@
     (remove-hook 'semantic-before-idle-scheduler-reparse-hook
 		 'semantic-show-parser-state-auto-marker t)
     (remove-hook 'semantic-after-idle-scheduler-reparse-hook
-		 'semantic-show-parser-state-marker t)
-    )
-  semantic-show-parser-state-mode)
-
-;;;###autoload
-(defun semantic-show-parser-state-mode (&optional arg)
-  "Minor mode for displaying parser cache state in the modeline.
-The cache can be in one of three states.  They are
-Up to date, Partial reparse needed, and Full reparse needed.
-The state is indicated in the modeline with the following characters:
- `-'  ->  The cache is up to date.
- `!'  ->  The cache requires a full update.
- `~'  ->  The cache needs to be incrementally parsed.
- `%'  ->  The cache is not currently parseable.
- `@'  ->  Auto-parse in progress (not set here.)
-With prefix argument ARG, turn on if positive, otherwise off.  The
-minor mode can be turned on only if semantic feature is available and
-the current buffer was set up for parsing.  Return non-nil if the
-minor mode is enabled."
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-show-parser-state-mode 0 1))))
-  (setq semantic-show-parser-state-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-show-parser-state-mode)))
-  (semantic-show-parser-state-mode-setup)
-  (run-hooks 'semantic-show-parser-state-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "show-parser-state minor mode %sabled"
-               (if semantic-show-parser-state-mode "en" "dis")))
-  (semantic-mode-line-update)
-  semantic-show-parser-state-mode)
+		 'semantic-show-parser-state-marker t))
+  (semantic-mode-line-update))
 
 (semantic-add-minor-mode 'semantic-show-parser-state-mode
-                         ""
-                         semantic-show-parser-state-mode-map)
+                         "")
 
 (defvar semantic-show-parser-state-string nil
   "String showing the parser state for this buffer.
@@ -710,30 +558,14 @@
 ;;;;
 
 ;;;###autoload
-(defun global-semantic-stickyfunc-mode (&optional arg)
+(define-minor-mode global-semantic-stickyfunc-mode
   "Toggle global use of option `semantic-stickyfunc-mode'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-semantic-stickyfunc-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-stickyfunc-mode arg)))
-
-;;;###autoload
-(defcustom global-semantic-stickyfunc-mode nil
-  "If non-nil, enable global use of `semantic-stickyfunc-mode'.
-This minor mode only works for Emacs 21 or later.
-When enabled, the header line is enabled, and the first line
-of the current function or method is displayed in it.
-This makes it appear that the first line of that tag is
-`sticky' to the top of the window."
-  :group 'semantic
-  :group 'semantic-modes
-  :type 'boolean
-  :require 'semantic/util-modes
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-stickyfunc-mode (if val 1 -1))))
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t :group 'semantic :group 'semantic-modes
+  ;; Not needed because it's autoloaded instead.
+  ;; :require 'semantic/util-modes
+  (semantic-toggle-minor-mode-globally
+   'semantic-stickyfunc-mode (if global-semantic-stickyfunc-mode 1 -1)))
 
 (defcustom semantic-stickyfunc-mode-hook nil
   "Hook run at the end of function `semantic-stickyfunc-mode'."
@@ -781,11 +613,6 @@
 	(describe-function 'semantic-stickyfunc-mode)) t])
   )
 
-(defvar semantic-stickyfunc-mode nil
-  "Non-nil if stickyfunc minor mode is enabled.
-Use the command `semantic-stickyfunc-mode' to change this variable.")
-(make-variable-buffer-local 'semantic-stickyfunc-mode)
-
 (defcustom semantic-stickyfunc-indent-string
   (if (and window-system (not (featurep 'xemacs)))
       (concat
@@ -870,11 +697,21 @@
 	(t nil))
   "The header line format used by stickyfunc mode.")
 
-(defun semantic-stickyfunc-mode-setup ()
-  "Setup option `semantic-stickyfunc-mode'.
-For semantic enabled buffers, make the function declaration for the top most
-function \"sticky\".  This is accomplished by putting the first line of
-text for that function in the header line."
+;;;###autoload
+(define-minor-mode semantic-stickyfunc-mode
+  "Minor mode to show the title of a tag in the header line.
+Enables/disables making the header line of functions sticky.
+A function (or other tag class specified by
+`semantic-stickyfunc-sticky-classes') has a header line, meaning the
+first line which describes the rest of the construct.  This first
+line is what is displayed in the header line.
+
+With prefix argument ARG, turn on if positive, otherwise off.  The
+minor mode can be turned on only if semantic feature is available and
+the current buffer was set up for parsing.  Return non-nil if the
+minor mode is enabled."
+  ;; Don't need indicator.  It's quite visible
+  :keymap semantic-stickyfunc-mode-map
   (if semantic-stickyfunc-mode
       (progn
 	(unless (and (featurep 'semantic) (semantic-active-p))
@@ -892,8 +729,7 @@
 			    semantic-stickyfunc-header-line-format)))
 	  (set (make-local-variable 'semantic-stickyfunc-old-hlf)
 	       header-line-format))
-	(setq header-line-format semantic-stickyfunc-header-line-format)
-	)
+	(setq header-line-format semantic-stickyfunc-header-line-format))
     ;; Disable sticky func mode
     ;; Restore previous buffer local value of header line format if
     ;; the current one is the sticky func one.
@@ -902,37 +738,7 @@
       (when (local-variable-p 'semantic-stickyfunc-old-hlf (current-buffer))
 	(setq header-line-format semantic-stickyfunc-old-hlf)
 	(kill-local-variable 'semantic-stickyfunc-old-hlf))))
-  semantic-stickyfunc-mode)
-
-;;;###autoload
-(defun semantic-stickyfunc-mode (&optional arg)
-  "Minor mode to show the title of a tag in the header line.
-Enables/disables making the header line of functions sticky.
-A function (or other tag class specified by
-`semantic-stickyfunc-sticky-classes') has a header line, meaning the
-first line which describes the rest of the construct.  This first
-line is what is displayed in the header line.
-
-With prefix argument ARG, turn on if positive, otherwise off.  The
-minor mode can be turned on only if semantic feature is available and
-the current buffer was set up for parsing.  Return non-nil if the
-minor mode is enabled."
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-stickyfunc-mode 0 1))))
-  (setq semantic-stickyfunc-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-stickyfunc-mode)))
-  (semantic-stickyfunc-mode-setup)
-  (run-hooks 'semantic-stickyfunc-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "Stickyfunc minor mode %sabled"
-               (if semantic-stickyfunc-mode "en" "dis")))
-  (semantic-mode-line-update)
-  semantic-stickyfunc-mode)
+  (semantic-mode-line-update))
 
 (defvar semantic-stickyfunc-sticky-classes
   '(function type)
@@ -1012,8 +818,7 @@
 
 
 (semantic-add-minor-mode 'semantic-stickyfunc-mode
-                         "" ;; Don't need indicator.  It's quite visible
-                         semantic-stickyfunc-mode-map)
+                         "") ;; Don't need indicator.  It's quite visible
 
 
 
@@ -1025,26 +830,15 @@
 ;; from the tag going off the top of the screen.
 
 ;;;###autoload
-(defun global-semantic-highlight-func-mode (&optional arg)
+(define-minor-mode global-semantic-highlight-func-mode
   "Toggle global use of option `semantic-highlight-func-mode'.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-semantic-highlight-func-mode
-        (semantic-toggle-minor-mode-globally
-         'semantic-highlight-func-mode arg)))
-
-;;;###autoload
-(defcustom global-semantic-highlight-func-mode nil
-  "If non-nil, enable global use of `semantic-highlight-func-mode'.
-When enabled, the first line of the current tag is highlighted."
-  :group 'semantic
-  :group 'semantic-modes
-  :type 'boolean
-  :require 'semantic/util-modes
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-semantic-highlight-func-mode (if val 1 -1))))
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t :group 'semantic :group 'semantic-modes
+  ;; Not needed because it's autoloaded instead.
+  ;; :require 'semantic/util-modes
+  (semantic-toggle-minor-mode-globally
+   'semantic-highlight-func-mode
+   (if global-semantic-highlight-func-mode 1 -1)))
 
 (defcustom semantic-highlight-func-mode-hook nil
   "Hook run at the end of function `semantic-highlight-func-mode'."
@@ -1108,11 +902,6 @@
       )
     (select-window startwin)))
 
-(defvar semantic-highlight-func-mode nil
-  "Non-nil if highlight-func minor mode is enabled.
-Use the command `semantic-highlight-func-mode' to change this variable.")
-(make-variable-buffer-local 'semantic-highlight-func-mode)
-
 (defvar semantic-highlight-func-ct-overlay nil
   "Overlay used to highlight the tag the cursor is in.")
 (make-variable-buffer-local 'semantic-highlight-func-ct-overlay)
@@ -1126,28 +915,8 @@
   "Face used to show the top of current function."
   :group 'semantic-faces)
 
-
-(defun semantic-highlight-func-mode-setup ()
-  "Setup option `semantic-highlight-func-mode'.
-For Semantic enabled buffers, highlight the first line of the
-current tag declaration."
-  (if semantic-highlight-func-mode
-      (progn
-	(unless (and (featurep 'semantic) (semantic-active-p))
-	  ;; Disable minor mode if semantic stuff not available
-	  (setq semantic-highlight-func-mode nil)
-	  (error "Buffer %s was not set up for parsing" (buffer-name)))
-	;; Setup our hook
-	(add-hook 'post-command-hook 'semantic-highlight-func-highlight-current-tag nil t)
-	)
-    ;; Disable highlight func mode
-    (remove-hook 'post-command-hook 'semantic-highlight-func-highlight-current-tag t)
-    (semantic-highlight-func-highlight-current-tag t)
-    )
-  semantic-highlight-func-mode)
-
 ;;;###autoload
-(defun semantic-highlight-func-mode (&optional arg)
+(define-minor-mode semantic-highlight-func-mode
   "Minor mode to highlight the first line of the current tag.
 Enables/disables making the current function's first line light up.
 A function (or other tag class specified by
@@ -1162,21 +931,20 @@
 minor mode can be turned on only if semantic feature is available and
 the current buffer was set up for parsing.  Return non-nil if the
 minor mode is enabled."
-  (interactive
-   (list (or current-prefix-arg
-             (if semantic-highlight-func-mode 0 1))))
-  (setq semantic-highlight-func-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not semantic-highlight-func-mode)))
-  (semantic-highlight-func-mode-setup)
-  (run-hooks 'semantic-highlight-func-mode-hook)
-  (if (called-interactively-p 'interactive)
-      (message "Highlight-Func minor mode %sabled"
-               (if semantic-highlight-func-mode "en" "dis")))
-  semantic-highlight-func-mode)
+  :lighter nil ;; Don't need indicator.  It's quite visible.
+  (if semantic-highlight-func-mode
+      (progn
+	(unless (and (featurep 'semantic) (semantic-active-p))
+	  ;; Disable minor mode if semantic stuff not available
+	  (setq semantic-highlight-func-mode nil)
+	  (error "Buffer %s was not set up for parsing" (buffer-name)))
+	;; Setup our hook
+	(add-hook 'post-command-hook
+                  'semantic-highlight-func-highlight-current-tag nil t))
+    ;; Disable highlight func mode
+    (remove-hook 'post-command-hook
+                 'semantic-highlight-func-highlight-current-tag t)
+    (semantic-highlight-func-highlight-current-tag t)))
 
 (defun semantic-highlight-func-highlight-current-tag (&optional disable)
   "Highlight the current tag under point.
@@ -1223,8 +991,7 @@
   nil)
 
 (semantic-add-minor-mode 'semantic-highlight-func-mode
-                         "" ;; Don't need indicator.  It's quite visible
-                         nil)
+                         "") ;; Don't need indicator.  It's quite visible
 
 (provide 'semantic/util-modes)
 
--- a/lisp/cedet/srecode/mode.el	Sat May 01 22:39:50 2010 -0400
+++ b/lisp/cedet/srecode/mode.el	Sat May 01 23:38:19 2010 -0400
@@ -37,19 +37,6 @@
 
 ;;; Code:
 
-(defcustom global-srecode-minor-mode nil
-  "Non-nil in buffers with Semantic Recoder macro keybindings."
-  :group 'srecode
-  :type 'boolean
-  :require 'srecode/mode
-  :initialize 'custom-initialize-default
-  :set (lambda (sym val)
-         (global-srecode-minor-mode (if val 1 -1))))
-
-(defvar srecode-minor-mode nil
-  "Non-nil in buffers with Semantic Recoder macro keybindings.")
-(make-variable-buffer-local 'srecode-minor-mode)
-
 (defcustom srecode-minor-mode-hook nil
   "Hook run at the end of the function `srecode-minor-mode'."
   :group 'srecode
@@ -150,7 +137,7 @@
   "Keymap for srecode minor mode.")
 
 ;;;###autoload
-(defun srecode-minor-mode (&optional arg)
+(define-minor-mode srecode-minor-mode
   "Toggle srecode minor mode.
 With prefix argument ARG, turn on if positive, otherwise off.  The
 minor mode can be turned on only if semantic feature is available and
@@ -158,16 +145,7 @@
 minor mode is enabled.
 
 \\{srecode-mode-map}"
-  (interactive
-   (list (or current-prefix-arg
-             (if srecode-minor-mode 0 1))))
-  ;; Flip the bits.
-  (setq srecode-minor-mode
-        (if arg
-            (>
-             (prefix-numeric-value arg)
-             0)
-          (not srecode-minor-mode)))
+  :keymap srecode-mode-map
   ;; If we are turning things on, make sure we have templates for
   ;; this mode first.
   (when srecode-minor-mode
@@ -176,25 +154,20 @@
 		(mapcar (lambda (map)
 			  (srecode-map-entries-for-mode map major-mode))
 			(srecode-get-maps))))
-      (setq srecode-minor-mode nil))
-    )
-  ;; Run hooks if we are turning this on.
-  (when srecode-minor-mode
-    (run-hooks 'srecode-minor-mode-hook))
-  srecode-minor-mode)
+      (setq srecode-minor-mode nil))))
 
 ;;;###autoload
-(defun global-srecode-minor-mode (&optional arg)
+(define-minor-mode global-srecode-minor-mode
   "Toggle global use of srecode minor mode.
-If ARG is positive, enable, if it is negative, disable.
-If ARG is nil, then toggle."
-  (interactive "P")
-  (setq global-srecode-minor-mode
-        (semantic-toggle-minor-mode-globally
-         'srecode-minor-mode arg)))
+If ARG is positive or nil, enable, if it is negative, disable."
+  :global t :group 'srecode
+  ;; Not needed because it's autoloaded instead.
+  ;; :require 'srecode/mode
+  (semantic-toggle-minor-mode-globally
+   'srecode-minor-mode (if global-srecode-minor-mode 1 -1)))
 
 ;; Use the semantic minor mode magic stuff.
-(semantic-add-minor-mode 'srecode-minor-mode "" srecode-mode-map)
+(semantic-add-minor-mode 'srecode-minor-mode "")
 
 ;;; Menu Filters
 ;;