Re: How to properly create a Srecode template
"Eric M. Ludlam" <[email protected]>
| Newsgroups | gmane.emacs.cedet |
|---|---|
| Message-ID | <[email protected]> |
On 07/15/2014 12:23 PM, Tu Do wrote:
> Hi Eric,
>
> I tried to create a template in Common Lisp like this:
>
> set mode "lisp-mode"
>
> context file
>
> template read-file
> ----
> (defun read-data ()
> (with-open-file (stream "hello")
> (let ((tmp (loop for line = (read-line stream nil :eof)
> until (eq line :eof)
> collect (map 'list #'parse-integer
> (split-sequence:split-sequence #\space line)))))
> (close stream)
> tmp)))
> ----
>
>
> And put it in ~/.emacs.d/srt/cl.srt
>
> I added the path ~/.emacs.d/srt to srecode-map-load-path variable to
> load the template. However, when I ran the command sre-insert in
> lisp-mode (was writing Common Lisp), my template didn't show up. But if
> I put it in one of the SRE templates that come with CEDET, then I can
> retrieve my template.
SRecode builds a cache of all the template files. You may need to use:
M-x srecode-map-update-map RET
to rebuild.
There is a test that makes sure this works with code like this:
(add-to-list 'srecode-map-load-path extradir)
(srecode-map-update-map t)
so hopefully that will help with your puzzle.
I often use
M-x srecode-dump-templates
to see where templates are coming from, and if the priorities are
getting set correctly.
Good Luck
Eric
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds