;;; 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>
(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."
])
)
)
(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
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
(define-key srecode-prefix-map oldkey nil)
)))
- ;; Update Keybings
+ ;; Update Keybindings
(let ((oldbinding (lookup-key srecode-prefix-map binding)))
;; During development, allow overrides.
;; generated-autoload-load-name: "srecode/mode"
;; End:
-;; arch-tag: 56ad9d6b-899b-4a68-8636-1432b6bc149b
;;; srecode/mode.el ends here