This should work:
(progn
(html-mode)
(insert-file-contents "~/index.html")
(insert "\nbase")
(yas/expand))
And please do try to read the elisp manual. It's very good.
UPD
I've updated the function. I see that you're new. To get a good answer you need to state clearly what you want to do. And if this answer is useful, don't forget to up-vote and accept.
Also, some comments on your code: concat
should be used
for strings, instead of concatenate
. And it's best not
to use y-or-n-p
- just do what you want to do, and
if you want to abort, use C-g.
(defun create-test (directory)
(interactive "D")
(with-current-buffer (find-file-noselect
(concat directory "index.html"))
(delete-region (point-min) (point-max))
(html-mode)
(insert "base")
(yas/expand)
(save-buffer)
(kill-buffer)))