]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/srecode/mode.el
Merge from trunk.
[gnu-emacs] / lisp / cedet / srecode / mode.el
index f1590ed5ec0e81f4bda2945c45ac170706e391c9..e2c07a0863e8ccad9d5f78eaf63515b1ec06d43b 100644 (file)
@@ -1,6 +1,6 @@
 ;;; srecode/mode.el --- Minor mode for managing and using SRecode templates
 
-;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2012 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
 
@@ -61,7 +61,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
      ["Dump Dictionary"
       srecode-dictionary-dump
       :active t
-      :help "Calculate a dump a dictionary for point."
+      :help "Calculate and dump a dictionary for point."
+      ])
+    (semantic-menu-item
+     ["Show Macro Help"
+      srecode-macro-help
+      :active t
+      :help "Display the different types of macros available."
       ])
     )
    )
@@ -196,43 +202,44 @@ MENU-DEF is the menu to bind this into."
       (setq context (car-safe (srecode-calculate-context)))
 
       (while subtab
-       (setq ltab (oref (car subtab) templates))
-       (while ltab
-         (setq temp (car ltab))
-
-         ;; Do something with this template.
-
-         (let* ((ctxt (oref temp context))
-                (ctxtcons (assoc ctxt alltabs))
-                (bind (if (slot-boundp temp 'binding)
-                          (oref temp binding)))
-                (name (object-name-string temp)))
-
-           (when (not ctxtcons)
-             (if (string= context ctxt)
-                 ;; If this context is not in the current list of contexts
-                 ;; is equal to the current context, then manage the
-                 ;; active list instead
-                 (setq active
-                       (setq ctxtcons (or active (cons ctxt nil))))
-               ;; This is not an active context, add it to alltabs.
-               (setq ctxtcons (cons ctxt nil))
-               (setq alltabs (cons ctxtcons alltabs))))
-
-           (let ((new (vector
-                       (if bind
-                           (concat name "   (" bind ")")
-                         name)
-                       `(lambda () (interactive)
-                          (srecode-insert (concat ,ctxt ":" ,name)))
-                       t)))
-
-             (setcdr ctxtcons (cons
-                               new
-                               (cdr ctxtcons)))))
-
-         (setq ltab (cdr ltab)))
-       (setq subtab (cdr subtab)))
+       (when (srecode-template-table-in-project-p (car subtab))
+         (setq ltab (oref (car subtab) templates))
+         (while ltab
+           (setq temp (car ltab))
+
+           ;; Do something with this template.
+
+           (let* ((ctxt (oref temp context))
+                  (ctxtcons (assoc ctxt alltabs))
+                  (bind (if (slot-boundp temp 'binding)
+                            (oref temp binding)))
+                  (name (object-name-string temp)))
+
+             (when (not ctxtcons)
+               (if (string= context ctxt)
+                   ;; If this context is not in the current list of contexts
+                   ;; is equal to the current context, then manage the
+                   ;; active list instead
+                   (setq active
+                         (setq ctxtcons (or active (cons ctxt nil))))
+                 ;; This is not an active context, add it to alltabs.
+                 (setq ctxtcons (cons ctxt nil))
+                 (setq alltabs (cons ctxtcons alltabs))))
+
+             (let ((new (vector
+                         (if bind
+                             (concat name "   (" bind ")")
+                           name)
+                         `(lambda () (interactive)
+                            (srecode-insert (concat ,ctxt ":" ,name)))
+                         t)))
+
+               (setcdr ctxtcons (cons
+                                 new
+                                 (cdr ctxtcons)))))
+
+           (setq ltab (cdr ltab))))
+       (setq subtab (cdr subtab)))
 
       ;; Now create the menu
       (easy-menu-filter-return
@@ -273,6 +280,7 @@ MENU-DEF is the menu to bind this into."
 This command will insert whichever srecode template has a binding
 to the current key."
   (interactive)
+  (srecode-load-tables-for-mode major-mode)
   (let* ((k last-command-event)
         (ctxt (srecode-calculate-context))
         ;; Find the template with the binding K
@@ -358,7 +366,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.
@@ -388,5 +396,4 @@ programming modes."
 ;; generated-autoload-load-name: "srecode/mode"
 ;; End:
 
-;; arch-tag: 56ad9d6b-899b-4a68-8636-1432b6bc149b
 ;;; srecode/mode.el ends here