mineo / yatemplate

File templates for Emacs with YASnippet
https://github.com/mineo/yatemplate
GNU General Public License v3.0
70 stars 11 forks source link

always picking the first template? #6

Closed fommil closed 9 years ago

fommil commented 9 years ago

this is my templates folder https://github.com/fommil/dotfiles/tree/master/.emacs.d/templates

(I've even tried renaming the scala template)

but every time I open a fresh scala file, I get hit with the .el insertion.

Is this supposed to work or is it very very beta?

fommil commented 9 years ago

my alist

((".*.el" . ["~/.emacs.d/templates/50:.*.el" yatemplate-expand-yas-buffer]) (".*.scala" . ["~/.emacs.d/templates/55:.*.scala" yatemplate-expand-yas-buffer]) (("\\.\\([Hh]\\|hh\\|hpp\\)\\'" . "C / C++ header") (upcase (concat ... "_" ...)) "#ifndef " str n "#define " str "

" _ "

#endif") (("\\.\\([Cc]\\|cc\\|cpp\\)\\'" . "C / C++ program") nil "#include \"" (let (...) (cond ... ...)) & 34 | -10) (("[Mm]akefile\\'" . "Makefile") . "makefile.inc") (html-mode lambda nil (sgml-tag "html")) (plain-tex-mode . "tex-insert.tex") (bibtex-mode . "tex-insert.tex") (latex-mode "options, RET: " "\\documentclass[" str & 93 | -1 123 (read-string "class: ") "}
" ("package, %s: " "\\usepackage[" (read-string "options, RET: ") & 93 | -1 123 str "}
") ...) (("/bin/.*[^/]\\'" . "Shell-Script mode magic number") lambda nil (if (eq major-mode ...) (sh-mode))) (ada-mode . ada-header) (("\\.[1-9]\\'" . "Man page skeleton") "Short description: " ".\\\" Copyright (C), " (format-time-string "%Y") "  " (getenv "ORGANIZATION") | (progn user-full-name) "
.\\\" You may distribute this file under the terms of the GNU Free
.\\\" Documentation License.
.TH " (file-name-base) " " (file-name-extension (buffer-file-name)) ...) ...)
fommil commented 9 years ago

(i.e. looks like its the actual expansion that's going wrong, not the creation of the alist)

fommil commented 9 years ago

I've now read all the code in yatemplate and I can't see what is going wrong!

fommil commented 9 years ago

HA!!! You're kidding me.

My two templates:

50:.*.el
55:.*.scala

and my file? shapeless-for-mortals/foo/bar.scala... notice that .*.el actually matches this!

I guess I should use .scala' in the filename instead, but adding an escape 55:.*\.scala seemed to do the trick

fommil commented 9 years ago

btw, using $ at the end of my filename worked, but using ' (as is emacs convention) did not. I wonder what is up there.

In any case, I hope these weird filenames work on Windows!