Function: srecode-edit
srecode-edit is an interactive and byte-compiled function defined in
mode.el.gz.
Signature
(srecode-edit TEMPLATE-NAME)
Documentation
Switch to the template buffer for TEMPLATE-NAME.
Template is chosen based on the mode of the starting buffer.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/srecode/mode.el.gz
(defun srecode-edit (template-name)
"Switch to the template buffer for TEMPLATE-NAME.
Template is chosen based on the mode of the starting buffer."
;; @todo - Get a template stack from the last run template, and show
;; those too!
(interactive (list (srecode-read-template-name
"Template Name: "
(car srecode-read-template-name-history))))
(if (not (srecode-table))
(error "No template table found for mode %s" major-mode))
(let ((temp (srecode-template-get-table (srecode-table) template-name)))
(if (not temp)
(error "No Template named %s" template-name))
;; We need a template specific table, since tables chain.
(let ((tab (oref temp table))
(names nil)
)
(find-file (oref tab file))
(setq names (semantic-find-tags-by-name (oref temp object-name)
(current-buffer)))
(cond ((= (length names) 1)
(semantic-go-to-tag (car names))
(semantic-momentary-highlight-tag (car names)))
((> (length names) 1)
(let* ((ctxt (semantic-find-tags-by-name (oref temp context)
(current-buffer)))
(cls (semantic-find-tags-by-class 'context ctxt))
)
(while (and names
(< (semantic-tag-start (car names))
(semantic-tag-start (car cls))))
(setq names (cdr names)))
(if names
(progn
(semantic-go-to-tag (car names))
(semantic-momentary-highlight-tag (car names)))
(error "Can't find template %s" template-name))
))
(t (error "Can't find template %s" template-name)))
)))