summaryrefslogtreecommitdiff
path: root/lisp/cedet/srecode
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/cedet/srecode')
-rw-r--r--lisp/cedet/srecode/fields.el2
-rw-r--r--lisp/cedet/srecode/mode.el49
-rw-r--r--lisp/cedet/srecode/srt-mode.el13
3 files changed, 15 insertions, 49 deletions
diff --git a/lisp/cedet/srecode/fields.el b/lisp/cedet/srecode/fields.el
index 9092467a583..817bb93d2fd 100644
--- a/lisp/cedet/srecode/fields.el
+++ b/lisp/cedet/srecode/fields.el
@@ -198,7 +198,7 @@ If SET-TO is a string, then replace the text of OLAID wit SET-TO."
(oset ir fields srecode-field-archive)
(setq srecode-field-archive nil)
- ;; Initailize myself first.
+ ;; Initialize myself first.
(call-next-method)
)
diff --git a/lisp/cedet/srecode/mode.el b/lisp/cedet/srecode/mode.el
index 08da334767d..bdb8172eb5e 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
@@ -156,7 +143,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
@@ -164,16 +151,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
@@ -182,25 +160,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
;;
diff --git a/lisp/cedet/srecode/srt-mode.el b/lisp/cedet/srecode/srt-mode.el
index dd2c062ca69..7df06a608f5 100644
--- a/lisp/cedet/srecode/srt-mode.el
+++ b/lisp/cedet/srecode/srt-mode.el
@@ -183,27 +183,20 @@ we can tell font lock about them.")
"Keymap used in srecode mode.")
;;;###autoload
-(defun srecode-template-mode ()
+(define-derived-mode srecode-template-mode fundamental-mode "SRecorder"
"Major-mode for writing SRecode macros."
- (interactive)
- (kill-all-local-variables)
- (setq major-mode 'srecode-template-mode
- mode-name "SRecoder"
- comment-start ";;"
+ (setq comment-start ";;"
comment-end "")
(set (make-local-variable 'parse-sexp-ignore-comments) t)
(set (make-local-variable 'comment-start-skip)
"\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
- (set-syntax-table srecode-template-mode-syntax-table)
- (use-local-map srecode-template-mode-map)
(set (make-local-variable 'font-lock-defaults)
'(srecode-font-lock-keywords
nil ;; perform string/comment fontification
nil ;; keywords are case sensitive.
;; This puts _ & - as a word constituant,
;; simplifying our keywords significantly
- ((?_ . "w") (?- . "w"))))
- (run-hooks 'srecode-template-mode-hook))
+ ((?_ . "w") (?- . "w")))))
;;;###autoload
(defalias 'srt-mode 'srecode-template-mode)