使用 ENSIME 时的 Scala 许可证横幅
我正在尝试开始使用 ENSIME 通过 SBT 进行 Scala 开发。我应该如何管理许可证标头?我曾经在 Eclipse 中使用版权向导,看起来不错。
I'm trying to start using ENSIME for Scala development with SBT. How should I manage license headers? I used to use Copyright Wizard in Eclipse and that seemed fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Emacs 有多种模板方法,这实际上取决于您的工作流程。对于版权,您可能只想向每个打开的新文件添加版权消息。上次我这样做是使用骨架包——现在有更新的包了。
也许是最容易设置的,但不是最灵活的。就是放置你的版权信息
到文件 scala.template 中并将该文件名添加到自动插入列表中。
scala.template 是一个要插入到每个新 scala 文件中的文件。要自动对新文件执行此操作,需要将自动插入功能添加到 find-file-hook 中。
这种机制非常强大,可以使用需要用户输入的函数或模板而不是简单的文件。例如,对于 C++ 头文件:
请参阅 http://www.emacswiki.org/emacs/AutoInsertMode#toc1
可以手动删除版权并调用自动插入。这可以通过宏来完成,也许在保存文件时调用。
对于更通用的版权消息自动更新,您可能需要查看版权包所采用的方法。使用此包检查版权可以在保存时使用 before-save-hook 执行。 http://www.gnu.org/software/emacs/manual /html_node/autotype/Copyrights.html
请参阅 http://www.emacswiki.org/emacs/自动文件头 。
也可以尝试在谷歌上搜索 auto-header.el 这也可能有帮助。
Emacs has many ways to template, it really depends on what your workflow is. For copyright you might just want to add a copyright message to each new file opened. Last time I did this was with the skeleton package--- there are newer packages now.
Perhaps the easiest to set up, but not the most flexible. Is to place your copyright message
into a file scala.template and add that filename to the auto-insert-alist.
scala.template is a file with which you want to insert into each new scala file. To do this automatically for new files the auto-insert function needs to be added to the find-file-hook.
This mechanism is very powerful, it is possible to use functions or templates that require user input instead of a simple file. For example for C++ header files:
See http://www.emacswiki.org/emacs/AutoInsertMode#toc1
It is possible to remove the copyright and call auto-insert manually. This might be done via a macro, perhaps called when you save the file.
For more versatile auto-updating of copyright messages you might want to look at the approach taken by the copyright package. Checking the copyright using this package can be performed on save using the before-save-hook. http://www.gnu.org/software/emacs/manual/html_node/autotype/Copyrights.html
See http://www.emacswiki.org/emacs/AutomaticFileHeaders .
Also try googling for auto-header.el which might help too.
我不认为 Emacs 有这样的东西,更不用说 ENSIME,但你可以轻松定义 abbrev 用于许可证标头并在需要时展开它。
这就是 Emacs 的伟大之处 - 它可能不完全有您所寻找的东西,但它肯定有您需要的一切。
I don't think Emacs has something like this, let alone ENSIME, but you can easily define an abbrev for the license header and expand it when you need it.
This is the greatness of Emacs - it might not have exactly what you look for, but it certainly has everything that you need.