【发布时间】:2013-08-10 17:15:30
【问题描述】:
我有一个创建空 html 文件的 lisp 脚本:
(let ((mode "html-mode"))
(funcall (intern mode)))
(write-region "" nil "index.html")
然后我使用 yasn-p 生成基本的 html 文件: 我有一个名为“base”的 sn-p(我按 TAB 键来展开它)
有没有办法在我的 lisp 脚本中使用这个 sn-p?
我尝试了,但没有成功使用(yas/expand-sn-p base)
谢谢。
古尔文。
编辑
使用 abo-abo 的代码,我得到了一些运行良好的东西:
(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...")
)))
我只需要使用 Mx cd 将当前目录设置到正确的位置。 可能有一个更有效的解决方案,无需在缓冲区中打开文件。但是这个已经很酷了。 谢谢阿布阿布
【问题讨论】: