Fix auto-insert templates and macro

This commit is contained in:
Henrik Lissner 2015-01-12 21:27:21 -05:00
parent db601a903d
commit 5728518b73

View file

@ -7,8 +7,8 @@
(setq auto-insert-alist '()))) (setq auto-insert-alist '())))
(after "yasnippet" (after "yasnippet"
(defun template (file-regexp uuid mode &optional project-only) (defmacro template (file-regexp uuid mode &optional project-only)
(define-auto-insert file-regexp `(lambda () (my--template-insert ,uuid ',mode ,project-only)))) `(define-auto-insert ,file-regexp '(lambda () (my--template-insert ,uuid ,mode ,project-only))))
(defun my--template-insert (uuid mode &optional project-only) (defun my--template-insert (uuid mode &optional project-only)
"Expand snippet template in MODE by its UUID" "Expand snippet template in MODE by its UUID"
@ -23,8 +23,8 @@
;; C/C++ ;; C/C++
(template "/Makefile$" "%%" 'makefile-gmake-mode) (template "/Makefile$" "%%" 'makefile-gmake-mode)
(template "/main\\.\\([Cc]\\|cc\\|cpp\\)$" "%main.cpp%" 'c++-mode) (template "/main\\.\\(cc\\|cpp\\)$" "%main.cpp%" 'c++-mode)
(template "/win32_\\.\\([Cc]\\|cc\\|cpp\\)$" "%winmain.cpp%" 'c++-mode) (template "/win32_\\.\\(cc\\|cpp\\)$" "%winmain.cpp%" 'c++-mode)
(template "\\.\\([Hh]\\|hpp\\)$" "%.h%" 'c++-mode) (template "\\.\\([Hh]\\|hpp\\)$" "%.h%" 'c++-mode)
(template "\\.\\([Cc]\\|cc\\|cpp\\)$" "%.cpp%" 'c++-mode) (template "\\.\\([Cc]\\|cc\\|cpp\\)$" "%.cpp%" 'c++-mode)