diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-05-01 23:38:19 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-05-01 23:38:19 -0400 |
commit | cb7f3653c838dd1ce01d80e725b4679b79bba256 (patch) | |
tree | a2f1adb1602ce93b783b452ed03491f18cf3bbe2 /lisp/cedet/srecode/mode.el | |
parent | a5a1e2ef820c01bec5a35e0fa5bac7a46894c9e7 (diff) | |
download | emacs-cb7f3653c838dd1ce01d80e725b4679b79bba256.tar.gz |
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.
Diffstat (limited to 'lisp/cedet/srecode/mode.el')
-rw-r--r-- | lisp/cedet/srecode/mode.el | 49 |
1 files changed, 11 insertions, 38 deletions
diff --git a/lisp/cedet/srecode/mode.el b/lisp/cedet/srecode/mode.el index f588eed2bb1..f1590ed5ec0 100644 --- a/lisp/cedet/srecode/mode.el +++ b/lisp/cedet/srecode/mode.el @@ -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 @@ the current buffer was set up for parsing. Return non-nil if the 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 @@ minor mode is enabled. (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 ;; |