Commit cb7f3653 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

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.
parent a5a1e2ef
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> 2010-05-01 Toru TSUNEYOSHI <t_tuneyosi@hotmail.com>
Michael Albinus <michael.albinus@gmx.de> Michael Albinus <michael.albinus@gmx.de>
...@@ -8,8 +48,8 @@ ...@@ -8,8 +48,8 @@
(tramp-inline-compress-commands): New defconst. (tramp-inline-compress-commands): New defconst.
(tramp-find-inline-compress, tramp-get-inline-compress) (tramp-find-inline-compress, tramp-get-inline-compress)
(tramp-get-inline-coding): New defuns. (tramp-get-inline-coding): New defuns.
(tramp-get-remote-coding, tramp-get-local-coding): Removed, (tramp-get-remote-coding, tramp-get-local-coding): Remove,
replaced by `tramp-get-inline-coding'. replace by `tramp-get-inline-coding'.
(tramp-handle-file-local-copy, tramp-handle-write-region) (tramp-handle-file-local-copy, tramp-handle-write-region)
(tramp-method-out-of-band-p): Use `tramp-get-inline-coding'. (tramp-method-out-of-band-p): Use `tramp-get-inline-coding'.
...@@ -41,8 +81,7 @@ ...@@ -41,8 +81,7 @@
2010-04-30 Chong Yidong <cyd@stupidchicken.com> 2010-04-30 Chong Yidong <cyd@stupidchicken.com>
* minibuffer.el (tags-completion-at-point-function): Fix return * minibuffer.el (tags-completion-at-point-function): Fix return value.
value.
2010-04-30 Eli Zaretskii <eliz@gnu.org> 2010-04-30 Eli Zaretskii <eliz@gnu.org>
......
...@@ -27,57 +27,46 @@ ...@@ -27,57 +27,46 @@
;; This provides a dired interface to EDE, allowing users to modify ;; This provides a dired interface to EDE, allowing users to modify
;; their project file by adding files (or whatever) directly from a ;; their project file by adding files (or whatever) directly from a
;; dired buffer. ;; dired buffer.
(eval-when-compile (require 'cl))
(require 'easymenu) (require 'easymenu)
(require 'dired) (require 'dired)
(require 'ede) (require 'ede)
;;; Code: ;;; Code:
(defvar ede-dired-minor-mode nil (defvar ede-dired-keymap
"Non-nil when in ede dired minor mode.") (let ((map (make-sparse-keymap)))
(make-variable-buffer-local 'ede-dired-minor-mode) (define-key map ".a" 'ede-dired-add-to-target)
(define-key map ".t" 'ede-new-target)
(defvar ede-dired-keymap nil (define-key map ".s" 'ede-speedbar)
(define-key map ".C" 'ede-compile-project)
(define-key map ".d" 'ede-make-dist)
(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.") "Keymap used for ede dired minor mode.")
(if ede-dired-keymap (define-minor-mode ede-dired-minor-mode
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)
"A minor mode that should only be activated in DIRED buffers. "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." negative, force off."
(interactive "P") :lighter " EDE" :keymap ede-dired-keymap
(if (not (or (eq major-mode 'dired-mode) (unless (derived-mode-p 'dired-mode)
(eq major-mode 'vc-dired-mode))) (setq ede-dired-minor-mode nil)
(error "Not in DIRED mode")) (error "Not in DIRED mode"))
(setq ede-dired-minor-mode (unless (or (ede-directory-project-p default-directory)
(not (or (and (null arg) ede-dired-minor-mode) (interactive-p))
(<= (prefix-numeric-value arg) 0)))) (setq ede-dired-minor-mode nil)))
(if (and (not (ede-directory-project-p default-directory))
(not (interactive-p)))
(setq ede-dired-minor-mode nil))
)
(defun ede-dired-add-to-target (target) (defun ede-dired-add-to-target (target)
"Add a file, or all marked files into a TARGET." "Add a file, or all marked files into a TARGET."
...@@ -85,24 +74,13 @@ negative, force off." ...@@ -85,24 +74,13 @@ negative, force off."
(let ((ede-object (ede-current-project))) (let ((ede-object (ede-current-project)))
(ede-invoke-method 'project-interactive-select-target (ede-invoke-method 'project-interactive-select-target
"Add files to Target: ")))) "Add files to Target: "))))
(let ((files (dired-get-marked-files t))) (dolist (file (dired-get-marked-files t))
(while files (project-add-file target file)
(project-add-file target (car files)) ;; Find the buffer for this files, and set it's ede-object
;; Find the buffer for this files, and set it's ede-object (if (get-file-buffer file)
(if (get-file-buffer (car files)) (with-current-buffer (get-file-buffer file)
(with-current-buffer (get-file-buffer (car files)) (setq ede-object nil)
(setq ede-object nil) (setq ede-object (ede-buffer-object (current-buffer)))))))
(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))))
(provide 'ede/dired) (provide 'ede/dired)
......
...@@ -224,46 +224,34 @@ Flush functions from `semantic-decorate-pending-decoration-hook'." ...@@ -224,46 +224,34 @@ Flush functions from `semantic-decorate-pending-decoration-hook'."
;; Generic mode for handling basic highlighting and decorations. ;; 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 ;;;###autoload
(defun global-semantic-decoration-mode (&optional arg) (define-minor-mode global-semantic-decoration-mode
"Toggle global use of option `semantic-decoration-mode'. "Toggle global use of option `semantic-decoration-mode'.
Decoration mode turns on all active decorations as specified Decoration mode turns on all active decorations as specified
by `semantic-decoration-styles'. by `semantic-decoration-styles'."
If ARG is positive, enable, if it is negative, disable. :global t :group 'semantic :group 'semantic-modes
If ARG is nil, then toggle." ;; Not needed because it's autoloaded instead.
(interactive "P") ;; :require 'semantic/decorate/mode
(setq global-semantic-decoration-mode (semantic-toggle-minor-mode-globally
(semantic-toggle-minor-mode-globally 'semantic-decoration-mode (if global-semantic-decoration-mode 1 -1)))
'semantic-decoration-mode arg)))
(defcustom semantic-decoration-mode-hook nil (defcustom semantic-decoration-mode-hook nil
"Hook run at the end of function `semantic-decoration-mode'." "Hook run at the end of function `semantic-decoration-mode'."
:group 'semantic :group 'semantic
:type 'hook) :type 'hook)
;;;;###autoload (define-minor-mode semantic-decoration-mode
(defvar semantic-decoration-mode nil "Minor mode for decorating tags.
"Non-nil if command `semantic-decoration-mode' is enabled. Decorations are specified in `semantic-decoration-styles'.
Use the command `semantic-decoration-mode' to change this variable.") You can define new decoration styles with
(make-variable-buffer-local 'semantic-decoration-mode) `define-semantic-decoration-style'.
With prefix argument ARG, turn on if positive, otherwise off. The
(defun semantic-decoration-mode-setup () minor mode can be turned on only if semantic feature is available and
"Setup the `semantic-decoration-mode' minor mode. the current buffer was set up for parsing. Return non-nil if the
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
minor mode is enabled." minor mode is enabled."
;;
;;\\{semantic-decoration-map}"
nil nil nil
(if semantic-decoration-mode (if semantic-decoration-mode
(if (not (and (featurep 'semantic) (semantic-active-p))) (if (not (and (featurep 'semantic) (semantic-active-p)))
(progn (progn
...@@ -280,8 +268,7 @@ minor mode is enabled." ...@@ -280,8 +268,7 @@ minor mode is enabled."
'semantic-decorate-tags-after-full-reparse nil t) 'semantic-decorate-tags-after-full-reparse nil t)
;; Add decorations to available tags. The above hooks ensure ;; Add decorations to available tags. The above hooks ensure
;; that new tags will be decorated when they become available. ;; 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. ;; Remove decorations from available tags.
(semantic-decorate-clear-decorations (semantic-fetch-available-tags)) (semantic-decorate-clear-decorations (semantic-fetch-available-tags))
;; Cleanup any leftover crap too. ;; Cleanup any leftover crap too.
...@@ -290,41 +277,11 @@ minor mode is enabled." ...@@ -290,41 +277,11 @@ minor mode is enabled."
(remove-hook 'semantic-after-partial-cache-change-hook (remove-hook 'semantic-after-partial-cache-change-hook
'semantic-decorate-tags-after-partial-reparse t) 'semantic-decorate-tags-after-partial-reparse t)
(remove-hook 'semantic-after-toplevel-cache-change-hook (remove-hook 'semantic-after-toplevel-cache-change-hook
'semantic-decorate-tags-after-full-reparse t) 'semantic-decorate-tags-after-full-reparse t))
) (semantic-mode-line-update))
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-add-minor-mode 'semantic-decoration-mode (semantic-add-minor-mode 'semantic-decoration-mode
"" "")
nil)
(defun semantic-decorate-tags-after-full-reparse (tag-list) (defun semantic-decorate-tags-after-full-reparse (tag-list)
"Add decorations after a complete reparse of the current buffer. "Add decorations after a complete reparse of the current buffer.
......
...@@ -128,16 +128,6 @@ unlikely the user would be ready to type again right away." ...@@ -128,16 +128,6 @@ unlikely the user would be ready to type again right away."
;; The minor mode portion of this code just sets up the minor mode ;; The minor mode portion of this code just sets up the minor mode
;; which does the initial scheduling of the idle timers. ;; 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 (defcustom semantic-idle-scheduler-mode-hook nil
"Hook run at the end of the function `semantic-idle-scheduler-mode'." "Hook run at the end of the function `semantic-idle-scheduler-mode'."
...@@ -167,24 +157,8 @@ exceeds the `semantic-idle-scheduler-max-buffer-size' threshold." ...@@ -167,24 +157,8 @@ exceeds the `semantic-idle-scheduler-max-buffer-size' threshold."
(or (<= semantic-idle-scheduler-max-buffer-size 0) (or (<= semantic-idle-scheduler-max-buffer-size 0)
(< (buffer-size) semantic-idle-scheduler-max-buffer-size)))) (< (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 ;;;###autoload
(defun semantic-idle-scheduler-mode (&optional arg) (define-minor-mode semantic-idle-scheduler-mode
"Minor mode to auto parse buffer following a change. "Minor mode to auto parse buffer following a change.
When this mode is off, a buffer is only rescanned for tokens when When this mode is off, a buffer is only rescanned for tokens when
some command requests the list of available tokens. When idle-scheduler some command requests the list of available tokens. When idle-scheduler
...@@ -195,26 +169,19 @@ With prefix argument ARG, turn on if positive, otherwise off. The ...@@ -195,26 +169,19 @@ With prefix argument ARG, turn on if positive, otherwise off. The
minor mode can be turned on only if semantic feature is available and 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 the current buffer was set up for parsing. Return non-nil if the
minor mode is enabled." minor mode is enabled."
(interactive nil nil nil
(list (or current-prefix-arg (if semantic-idle-scheduler-mode
(if semantic-idle-scheduler-mode 0 1)))) (if (not (and (featurep 'semantic) (semantic-active-p)))
(setq semantic-idle-scheduler-mode (progn
(if arg ;; Disable minor mode if semantic stuff not available
(> (setq semantic-idle-scheduler-mode nil)
(prefix-numeric-value arg) (error "Buffer %s was not set up idle time scheduling"
0) (buffer-name)))
(not semantic-idle-scheduler-mode))) (semantic-idle-scheduler-setup-timers)))
(semantic-idle-scheduler-mode-setup) (semantic-mode-line-update))
(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)
(semantic-add-minor-mode 'semantic-idle-scheduler-mode (semantic-add-minor-mode 'semantic-idle-scheduler-mode
"ARP" "ARP")
nil)
;;; SERVICES services ;;; SERVICES services
;; ;;
...@@ -582,31 +549,23 @@ This routine creates the following functions and variables:" ...@@ -582,31 +549,23 @@ This routine creates the following functions and variables:"
(mode (intern (concat (symbol-name name) "-mode"))) (mode (intern (concat (symbol-name name) "-mode")))
(hook (intern (concat (symbol-name name) "-mode-hook"))) (hook (intern (concat (symbol-name name) "-mode-hook")))
(map (intern (concat (symbol-name name) "-mode-map"))) (map (intern (concat (symbol-name name) "-mode-map")))
(setup (intern (concat (symbol-name name) "-mode-setup")))
(func (intern (concat (symbol-name name) "-idle-function")))) (func (intern (concat (symbol-name name) "-idle-function"))))
`(eval-and-compile `(eval-and-compile
(defun ,global (&optional arg) (define-minor-mode ,global
,(concat "Toggle " (symbol-name global) ". ,(concat "Toggle " (symbol-name global) ".
With ARG, turn the minor mode on if ARG is positive, off otherwise. With ARG, turn the minor mode on if ARG is positive, off otherwise.
When this minor mode is enabled, `" (symbol-name mode) "' is When this minor mode is enabled, `" (symbol-name mode) "' is
turned on in every Semantic-supported buffer.") turned on in every Semantic-supported buffer.")
(interactive "P") :global t
(setq ,global
(semantic-toggle-minor-mode-globally
',mode arg)))
(defcustom ,global nil
,(concat "Non-nil if `" (symbol-name mode) "' is enabled.")
:group 'semantic :group 'semantic
:group 'semantic-modes :group 'semantic-modes
:type 'boolean
:require 'semantic/idle :require 'semantic/idle
:initialize 'custom-initialize-default (semantic-toggle-minor-mode-globally
:set (lambda (sym val) ',mode (if ,global 1 -1)))
(,global (if val 1 -1))))
;; FIXME: Get rid of this when define-minor-mode does it for us.
(defcustom ,hook nil (defcustom ,hook nil
,(concat "Hook run at the end of function `" (symbol-name mode) "'.") ,(concat "Hook run at the end of function `" (symbol-name mode) "'.")
:group 'semantic :group 'semantic
...@@ -617,14 +576,9 @@ turned on in every Semantic-supported buffer.") ...@@ -617,14 +576,9 @@ turned on in every Semantic-supported buffer.")
km) km)
,(concat "Keymap for `" (symbol-name mode) "'.")) ,(concat "Keymap for `" (symbol-name mode) "'."))
(defvar ,mode nil (define-minor-mode ,mode
,(concat "Non-nil if the minor mode `" (symbol-name mode) "' is enabled. ,doc
Use the command `" (symbol-name mode) "' to change this variable.")) :keymap ,map
(make-variable-buffer-local ',mode)
(defun ,setup ()
,(concat "Set up `" (symbol-name mode) "'.
Return non-nil if the minor mode is enabled.")
(if ,mode (if ,mode
(if (not (and (featurep 'semantic) (semantic-active-p))) (if (not (and (featurep 'semantic) (semantic-active-p)))
(progn (progn
...@@ -633,36 +587,13 @@ Return non-nil if the minor mode is enabled.") ...@@ -633,36 +587,13 @@ Return non-nil if the minor mode is enabled.")
(error "Buffer %s was not set up for parsing" (error "Buffer %s was not set up for parsing"
(buffer-name))) (buffer-name)))
;; Enable the mode mode ;; Enable the mode mode
(semantic-idle-scheduler-add #',func) (semantic-idle-scheduler-add #',func))
)
;; Disable the mode mode ;; Disable the mode mode
(semantic-idle-scheduler-remove #',func) (semantic-idle-scheduler-remove #',func))
) (semantic-mode-line-update))
,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-add-minor-mode ',mode (semantic-add-minor-mode ',mode
"" ; idle schedulers are quiet? "") ; idle schedulers are quiet?
,map)
(defun ,func () (defun ,func ()
,(concat "Perform idle activity for the minor mode `" ,(concat "Perform idle activity for the minor mode `"
...@@ -814,21 +745,6 @@ When this minor mode is enabled, the echo area displays a summary ...@@ -814,21 +745,6 @@ When this minor mode is enabled, the echo area displays a summary
of the lexical token at point whenever Emacs is idle." of the lexical token at point whenever Emacs is idle."
:group 'semantic :group 'semantic
:group 'semantic-modes :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 (if semantic-idle-summary-mode
;; Enable the mode ;; Enable the mode
(progn (progn
...@@ -843,7 +759,17 @@ of the lexical token at point whenever Emacs is idle." ...@@ -843,7 +759,17 @@ of the lexical token at point whenever Emacs is idle."
;; Disable the mode ;; Disable the mode
(semantic-idle-scheduler-remove 'semantic-idle-summary-idle-function) (semantic-idle-scheduler-remove 'semantic-idle-summary-idle-function)
(remove-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t)) (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 "") (semantic-add-minor-mode 'semantic-idle-summary-mode "")
...@@ -957,22 +883,22 @@ Call `semantic-symref-hits-in-region' to identify local references." ...@@ -957,22 +883,22 @@ Call `semantic-symref-hits-in-region' to identify local references."
;;;###autoload ;;;###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'. "Toggle global use of option `semantic-idle-scheduler-mode'.
The idle scheduler will automatically reparse buffers in idle time, The idle scheduler will automatically reparse buffers in idle time,