为用户安装的 elisp 维护 Emacs 自动加载文件? [英] Maintaining Emacs autoload files for user-installed elisp?

查看:30
本文介绍了为用户安装的 elisp 维护 Emacs 自动加载文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Emacs 有这个看起来非常好的工具,可以基于 ;;;###autoload 形式的神奇源代码注释(自动加载 cookie")构建 自动加载 文件,它们将单独放置在每个要自动加载的定义上方的行上;参见 (elisp)Autoload.

Emacs has this seemingly very nice facility for building autoload files based on magic source code comments ("autoload cookies") of the form ;;;###autoload, which are to be placed on lines by themselves immediately above each definition to be autoloaded; see (elisp)Autoload.

对于那些 Emacs 用户不可避免地最终安装在他们的配置文件中的小单文件包,这似乎是维护自动加载的理想工具.只有一个小问题:这个工具(无论如何在 GNU Emacs 中)似乎几乎完全专注于为 Emacs 本身生成 loaddefs.el 文件,很少(如果有的话)让步给其他用途.

This would seem to be an ideal tool for maintaining autoloads for those little one-file packages that Emacs users inevitably end up installing in their profiles. There's just one small problem: this facility (in GNU Emacs, anyway) appears to be almost entirely focused on generating the loaddefs.el file for Emacs itself, with very little (if any) concession to other uses.

这并不能阻止较大的包使用 autoloads.el 机制来构建他们自己的自动加载文件,但是我看过的那些有相当多的相当长的代码专门用于制作它会做需要的事情,尽管有些毛病可能是由于 GNU Emacs/XEmacs 的分歧造成的.

This doesn't stop largish packages from using the autoloads.el machinery to build their own autoload files, but those that I've looked at have a fair bit of rather hairy code devoted to making it do what is needed, though some of the hairiness might be due to GNU Emacs/XEmacs divergence.

(我认为 XEmacs 在这方面要好一些,可能至少部分是因为它的官方包系统使用这种机制为每个包制作单独的自动加载文件.希望 GNU Emacs 包含 ELPA 包系统也使用这种机制,在他们这边也带来了类似的改进.)

(I think XEmacs is a bit better on this front, probably due at least in part to the fact that its official package system uses this machinery to make separate autoload files for each package. Hopefully GNU Emacs' inclusion of the ELPA package system, which also uses this machinery, leads to similar improvements on their side.)

所以,我想问你的问题是:

So, my question for you is:

我应该如何为目录中的所有 .el 文件维护自动加载文件,假设它们具有所有必需的 ;;;###autoload 注释(自动加载 cookie) 已经到位了吗?

How should I maintain an autoload file for all .el files in a directory, assuming they have all the necessary ;;;###autoload comments (autoload cookies) in place already?

[嗯.块引号在 tex.SE 上看起来很酷...]

[Hmm. block quotes look a lot coolor on tex.SE...]

我目前使用的是 GNU Emacs 23.2.1,尽管答案越有效越好.(就此而言,如果它也适用于 XEmacs 那就太好了.)

I'm currently using GNU Emacs 23.2.1, though the farther back an answer works, the better. (For that matter, it'd be nice if it would also work with XEmacs.)

我使用的是 Windows,但是 MSYS 与 Emacs 一起安装,所以 sh/bash 脚本可能没问题,只要它们不调用任何非常奇特的东西.

I'm on Windows, but have MSYS installed alongside Emacs so sh/bash scripts will probably be fine as long as they don't call anything terribly exotic.

[我不完全确定这不属于超级用户而不是 SO.如果已经有一个只需要少量配置就可以解决这个问题的包,它可能会这样做;另一方面,如果(正如我怀疑的那样)只有相当粗略的代码片段可能需要大量直接更改,我认为它可能属于 SO.]

[I'm not entirely certain this doesn't belong on superuser rather than on SO. If there is already a package that can take care of this with only a small amount of configuration, it probably does; on the other hand if (as I suspect) there are only fairly rough snippets of code that might require a good deal of direct changes, I think it probably belongs here on SO.]

推荐答案

查看 这个答案 "emacs23/elisp:如何正确自动加载这个库?".

总而言之,您转储特定目录中的所有包,并创建您自己的 update-auto-loads.el 包,它构建 loaddefs.el> 并提供一个函数,您可以定期运行以随时重建loaddefs.el 文件.

In summary, you dump all the packages in a particular directory, and create a package of your own update-auto-loads.el, which builds the loaddefs.el and provides a function you can regularly run to rebuild the loaddefs.el file whenever you want.

这篇关于为用户安装的 elisp 维护 Emacs 自动加载文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆