I have a lisp script that creates an empty html file:
(let ((mode "html-mode"))
(funcall (intern mode)))
(write-region "" nil "index.html")
Then i'm using yasnippet to generate the basic html file: I have a snippet named "base" (i hit TAB key to expand it)
Is there a way to use this snippet in my lisp script?
i try, with no succes to use (yas/expand-snippet base)
Thanks.
Goulven.
EDIT
Using the code of abo-abo, I got something that works well:
(defun create-web-site-test()
(interactive)
(setq msg (concatenate 'string "Create web site in : " default-directory))
(if (y-or-n-p msg)
(progn
(write-region "" nil "./index.html")
(find-file "./index.html")
(html-mode)
(insert "\nbase")
(yas/expand)
(save-buffer)
(kill-buffer))
(progn
;; Give up
(message "Ok, nothing will be donne, bybye...")
)))
I just need to set the current directory to the right place using Mx cd. There is probably a more effective solution, without opening the file in a buffer. But this one is already pretty cool. Thanks abo-abo