`
forever8tf
  • 浏览: 98047 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

emacs 使用 template

阅读更多

折腾了一下午,总算搞好了。

首先是折腾 yasnippet,可是 expand 看不懂,官方大家都说简单,可见我水平一般到什么程度。

再次折腾 template-simple,根本一点也不 simple 好么,但抱着支持国人的决心,挣扎纠结还是放弃了。

最后折腾 template.el,被 emacs 打败了。全是尼玛的傲骄萌物啊。

 

根据 template 中的 INSTALL 安装好即可使用(前提是你将东西都放到了制定的位置,比如 Templates 要放在 ~/.templates 下)。成功后我想简单的定制一下,将 Templates 放在 ~/.emacs.d/template/templates 下,就这简单的一步浪费了一下午。

 

查看 template.el 的源码,如下:

(defcustom template-default-directories
  (cons (if (and (not (file-directory-p "~/.templates/"))
		 (file-directory-p "~/lib/templates"))
	    (expand-file-name "~/lib/templates/")
	  (expand-file-name "~/.templates/"))
	(and (fboundp 'locate-data-directory)
	     (let ((dir (locate-data-directory "template")))
	       (and dir (list dir)))))
  "*List of default directories for template files.
See `template-derivation-alist' for details."
  :group 'template-derivation
  :type '(repeat directory))

 我真的天真的以为这是 template.el 设置查找 Templates 的目录,所以我这样:

(setq template-default-directories "~/.emacs.d/template/templates/“)

 结果尼玛无用啊,还提示错误。

后来在这篇,还有这篇中看出了端弥,需要这样配置:

(setq template-subdirectories '("~/.emacs.d/template/templates"))

完整配置如下:

;; 定义模版
(add-to-list 'load-path "~/.emacs.d/template/")
(require 'template)
;; 必须这么指定 搜索目录,蛋疼
(setq template-subdirectories '("~/.emacs.d/template/templates"))
(setq template-auto-insert t)
(template-initialize)
(add-to-list 'template-find-file-commands
             'ido-exit-minibuffer)
;; 结束

  这样就搞定了,具体原因需要等我过了6级以后在告诉大家.....

上图一张


 

  • 大小: 124 KB
分享到:
评论

相关推荐

    verilog mode for emacs (quick tips)

    ### Verilog Mode for Emacs:快速使用指南与技巧 #### 关于Verilog-Mode Verilog-Mode 是一个专为 Emacs 设计的模式,用于改善在 Emacs 编辑器中编写 Verilog 代码的体验。Verilog 作为一种常用的硬件描述语言...

    template-overlays:使用Emacs叠加层显示模板区域

    模板文件的Emacs 安装 梅尔帕 MELPA有售 通过el-get (push '(:name template-overlays :type git :url "git://github.com/mmontone/template-overlays.git" :features template-overlays :depends (ov) :...

    Template Package for Emacs-开源

    - **template.info**:这是一个Emacs Info格式的文档,用于详细解释模板包的使用方法和功能。用户可以通过Emacs的Info阅读器来查阅这个文档,获取帮助和指南。 - **templates**:这个文件可能是包含多个模板的目录...

    Template Menu For Emacs-开源

    template-menu是一个Emacs软件包,它向您的Emacs File菜单添加了一个Insert Template子菜单。 它依赖于Christoph Wedler创建的template.el包。

    emacs-bootstrap:您的动态Emacs开发环境

    starter-template 是指Emacs-bootstrap提供的一套基础模板,包括了必要的配置和推荐的插件集合,为新手提供一个良好的开端。用户可以根据自己的需求添加或删除模板中的部分,逐步建立属于自己的高效开发环境。 ...

    kaarvok:从 emacs 中的模板生成目录结构

    可以通过将所需的目录和文件放入kaarvok-templates-directory (默认为“~/.emacs.d/templates”)来创建模板。 将查找以.etpl结尾的文件以查找可能的替换,其他文件将直接复制。 文件和目录名称可以只是或包含变量...

    templatel:Emacs Lisp的Jinja启发式模板语言

    `templatel`通常配合Emacs的模板系统,如`yas-template`或`org-babel`,将模板编译为Lisp代码,然后执行生成动态内容。`templatel-main`可能包含一个`templatel`模板的示例,可以用来学习和实践模板引擎的用法。 **...

    .emacs.d:我的Emacs配置

    init-template.el :用于配置模板的文件 common / ::通用配置目录 init-better-default.el : init-better-default.el的替代配置 init-hydra-one-key.el :基于hydra插件的快捷键统一配置(包含模式和插件的快捷键)...

    lemonbar.el:从Emacs内部运行Lemonbar

    先决条件埃马克斯25.1配置自定义lemonbar-output-template变量以为您的Lemonbar指定模板。 提供了一个将系统状态从i3status馈送到lemonbar.el的示例。 将(lemonbar-start)添加到您的init.el中。执照GPL v3

    exwm-x:基于EXWM的派生WM(emacs x窗口管理器)

    “ exwmx-appconfig”是一个数据库管理器,用于记录和管理appconfigs(一个appconfig是应用程序信息的列表),当运行命令“ exwmx-appconfig”时,将弹出一个带有appconfig-template的缓冲区,用户可以编辑模板并...

    org-popup:使用弹出窗口记录emacs org-mode

    使用弹出窗口记录emacs组织模式 特征 快速记笔记 剪贴板默认插入模板 没有任何限制,其中数据仅由一个变量(正文)携带,并且不允许换行,制表符等。 不需要正在运行的客户端 添加前请验证注释。 如果使用org-...

    网络模式:emacs的网络模板编辑模式

    web-mode.el是emacs的主要模式,用于编辑Web模板,又称HTML文件嵌入部分(CSS / JavaScript)和块(由客户端/服务器端引擎预先呈现)。 web-mode.el与许多模板引擎兼容:PHP,JSP,ASP,Django,Twig,Jinja,...

    GVIM verilog插件,automatic改进版!

    在著名的GVIM verilog插件automatic基础上,经过大神修改。非常好用!! description: Support Automatic functions like Emacs for verilog hdl RtlTree work like as Verdi ... 5) Auto Template --

    org-invoice-template::books:使用Org模式时钟报告创建发票的模板

    要使用这个模板,你需要在Emacs中打开`invoice.org`,添加或修改时钟条目,填入客户信息,然后使用Org-Babel导出到LaTeX。运行Makefile或者手动运行LaTeX命令(如`pdflatex`)来生成PDF。通过这种方式,你就可以快速...

    template-latex-paper-from-orgmode:从orgmode创建乳胶文档的文件集

    从Emacs orgmode编写LaTeX文档的模板 一组(大多数)自解释文件,用于使用orgmode编写文档的结构和内容,然后将其插入到Latex模板中。 用例是日记/发布者等规定了要使用的乳胶样式,类和详细命令。 要求:最新的...

    org-mode-cv-template

    组织模式简历模板 ...该模板旨在使用 Emacs 进行编辑:组织模式允许轻松包含、排除和移动条目。 Org Mode 的“org-babel-tangle”将以 LaTeX 格式导出模板。 如果您不想使用 Emacs,只需编辑 .latex 文件

    latex-gost-template:根据 GOST 创建乳胶文件的模板

    适合那些使用文本编辑器(Vim、Sublime、Emacs 等)的人。 组装是使用 pdflatex 完成的。 分别使用bibtex时,需要依次调用pdflatex、bibtex和pdflatex() 将来我会制作一个包含最佳实践的文件。 将问题或错误...

    gahag.github.io:我的主页

    在Gitlab页面上发布组织模式项目 使用网站示例。... emacs -l serve.el # Open http://localhost:8000/ in the Web browser. 或使用Python的http.server模块在本地呈现页面, # Python 3.7 python -m http.

Global site tag (gtag.js) - Google Analytics