diff options
| author | Stefan Monnier | 2010-05-01 23:38:19 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2010-05-01 23:38:19 -0400 |
| commit | cb7f3653c838dd1ce01d80e725b4679b79bba256 (patch) | |
| tree | a2f1adb1602ce93b783b452ed03491f18cf3bbe2 /lisp/cedet/srecode | |
| parent | a5a1e2ef820c01bec5a35e0fa5bac7a46894c9e7 (diff) | |
| download | emacs-cb7f3653c838dd1ce01d80e725b4679b79bba256.tar.gz emacs-cb7f3653c838dd1ce01d80e725b4679b79bba256.zip | |
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')
| -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 @@ | |||
| 37 | 37 | ||
| 38 | ;;; Code: | 38 | ;;; Code: |
| 39 | 39 | ||
| 40 | (defcustom global-srecode-minor-mode nil | ||
| 41 | "Non-nil in buffers with Semantic Recoder macro keybindings." | ||
| 42 | :group 'srecode | ||
| 43 | :type 'boolean | ||
| 44 | :require 'srecode/mode | ||
| 45 | :initialize 'custom-initialize-default | ||
| 46 | :set (lambda (sym val) | ||
| 47 | (global-srecode-minor-mode (if val 1 -1)))) | ||
| 48 | |||
| 49 | (defvar srecode-minor-mode nil | ||
| 50 | "Non-nil in buffers with Semantic Recoder macro keybindings.") | ||
| 51 | (make-variable-buffer-local 'srecode-minor-mode) | ||
| 52 | |||
| 53 | (defcustom srecode-minor-mode-hook nil | 40 | (defcustom srecode-minor-mode-hook nil |
| 54 | "Hook run at the end of the function `srecode-minor-mode'." | 41 | "Hook run at the end of the function `srecode-minor-mode'." |
| 55 | :group 'srecode | 42 | :group 'srecode |
| @@ -150,7 +137,7 @@ | |||
| 150 | "Keymap for srecode minor mode.") | 137 | "Keymap for srecode minor mode.") |
| 151 | 138 | ||
| 152 | ;;;###autoload | 139 | ;;;###autoload |
| 153 | (defun srecode-minor-mode (&optional arg) | 140 | (define-minor-mode srecode-minor-mode |
| 154 | "Toggle srecode minor mode. | 141 | "Toggle srecode minor mode. |
| 155 | With prefix argument ARG, turn on if positive, otherwise off. The | 142 | With prefix argument ARG, turn on if positive, otherwise off. The |
| 156 | minor mode can be turned on only if semantic feature is available and | 143 | 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 | |||
| 158 | minor mode is enabled. | 145 | minor mode is enabled. |
| 159 | 146 | ||
| 160 | \\{srecode-mode-map}" | 147 | \\{srecode-mode-map}" |
| 161 | (interactive | 148 | :keymap srecode-mode-map |
| 162 | (list (or current-prefix-arg | ||
| 163 | (if srecode-minor-mode 0 1)))) | ||
| 164 | ;; Flip the bits. | ||
| 165 | (setq srecode-minor-mode | ||
| 166 | (if arg | ||
| 167 | (> | ||
| 168 | (prefix-numeric-value arg) | ||
| 169 | 0) | ||
| 170 | (not srecode-minor-mode))) | ||
| 171 | ;; If we are turning things on, make sure we have templates for | 149 | ;; If we are turning things on, make sure we have templates for |
| 172 | ;; this mode first. | 150 | ;; this mode first. |
| 173 | (when srecode-minor-mode | 151 | (when srecode-minor-mode |
| @@ -176,25 +154,20 @@ minor mode is enabled. | |||
| 176 | (mapcar (lambda (map) | 154 | (mapcar (lambda (map) |
| 177 | (srecode-map-entries-for-mode map major-mode)) | 155 | (srecode-map-entries-for-mode map major-mode)) |
| 178 | (srecode-get-maps)))) | 156 | (srecode-get-maps)))) |
| 179 | (setq srecode-minor-mode nil)) | 157 | (setq srecode-minor-mode nil)))) |
| 180 | ) | ||
| 181 | ;; Run hooks if we are turning this on. | ||
| 182 | (when srecode-minor-mode | ||
| 183 | (run-hooks 'srecode-minor-mode-hook)) | ||
| 184 | srecode-minor-mode) | ||
| 185 | 158 | ||
| 186 | ;;;###autoload | 159 | ;;;###autoload |
| 187 | (defun global-srecode-minor-mode (&optional arg) | 160 | (define-minor-mode global-srecode-minor-mode |
| 188 | "Toggle global use of srecode minor mode. | 161 | "Toggle global use of srecode minor mode. |
| 189 | If ARG is positive, enable, if it is negative, disable. | 162 | If ARG is positive or nil, enable, if it is negative, disable." |
| 190 | If ARG is nil, then toggle." | 163 | :global t :group 'srecode |
| 191 | (interactive "P") | 164 | ;; Not needed because it's autoloaded instead. |
| 192 | (setq global-srecode-minor-mode | 165 | ;; :require 'srecode/mode |
| 193 | (semantic-toggle-minor-mode-globally | 166 | (semantic-toggle-minor-mode-globally |
| 194 | 'srecode-minor-mode arg))) | 167 | 'srecode-minor-mode (if global-srecode-minor-mode 1 -1))) |
| 195 | 168 | ||
| 196 | ;; Use the semantic minor mode magic stuff. | 169 | ;; Use the semantic minor mode magic stuff. |
| 197 | (semantic-add-minor-mode 'srecode-minor-mode "" srecode-mode-map) | 170 | (semantic-add-minor-mode 'srecode-minor-mode "") |
| 198 | 171 | ||
| 199 | ;;; Menu Filters | 172 | ;;; Menu Filters |
| 200 | ;; | 173 | ;; |