]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/srecode/mode.el
Update copyright year to 2016
[gnu-emacs] / lisp / cedet / srecode / mode.el
index 6ca0cefe9a727819bd6c2907beab8011b6789c17..9754b8ce3d088dfce1658c22cb9611510e511eed 100644 (file)
@@ -1,6 +1,6 @@
 ;;; srecode/mode.el --- Minor mode for managing and using SRecode templates
 
-;; Copyright (C) 2008-2011 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2016 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
 
 (require 'srecode/map)
 (require 'semantic/decorate)
 (require 'semantic/wisent)
+(require 'semantic/senator)
+(require 'semantic/wisent)
 
-(eval-when-compile (require 'semantic/find))
+(eval-when-compile
+  (require 'semantic/find))
 
 ;;; Code:
 
@@ -61,7 +64,7 @@
        (define-key km (format "%c" k) 'srecode-bind-insert)
        (setq k (1+ k))))
     km)
-  "Keymap used behind the srecode prefix key in in srecode minor mode.")
+  "Keymap used behind the srecode prefix key in srecode minor mode.")
 
 (defvar srecode-menu-bar
   (list
@@ -154,13 +157,22 @@ minor mode is enabled.
   :keymap srecode-mode-map
   ;; If we are turning things on, make sure we have templates for
   ;; this mode first.
-  (when srecode-minor-mode
-    (when (not (apply
+  (if srecode-minor-mode
+      (if (not (apply
                'append
                (mapcar (lambda (map)
                          (srecode-map-entries-for-mode map major-mode))
                        (srecode-get-maps))))
-      (setq srecode-minor-mode nil))))
+         (setq srecode-minor-mode nil)
+       ;; Else, we have success, do stuff
+       (add-hook 'cedet-m3-menu-do-hooks 'srecode-m3-items nil t)
+       )
+    (remove-hook 'cedet-m3-menu-do-hooks 'srecode-m3-items t)
+    )
+  ;; Run hooks if we are turning this on.
+  (when srecode-minor-mode
+    (run-hooks 'srecode-minor-mode-hook))
+  srecode-minor-mode)
 
 ;;;###autoload
 (define-minor-mode global-srecode-minor-mode
@@ -213,7 +225,7 @@ MENU-DEF is the menu to bind this into."
                   (ctxtcons (assoc ctxt alltabs))
                   (bind (if (slot-boundp temp 'binding)
                             (oref temp binding)))
-                  (name (object-name-string temp)))
+                  (name (eieio-object-name-string temp)))
 
              (when (not ctxtcons)
                (if (string= context ctxt)
@@ -366,7 +378,7 @@ programming modes."
        (define-key srecode-prefix-map oldkey nil)
        )))
 
-  ;; Update Keybings
+  ;; Update Keybindings
   (let ((oldbinding (lookup-key srecode-prefix-map binding)))
 
     ;; During development, allow overrides.