Emacs 24 包系统初始化问题 [英] Emacs 24 Package System Initialization Problems

查看:21
本文介绍了Emacs 24 包系统初始化问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我看来,Emacs 24 内置的新包系统在正确加载和初始化已安装的包方面存在一些缺陷.

It seems to me that the new Package system that is built-in on Emacs 24 has some flaws when it comes to properly loading and initializing the installed packages.

最近,我升级到了 6/10/2012 发布的 Emacs 24.1.1,我一直在尝试使用内置的包系统并安装了几个使用它的包,但它们都有类似的问题自动加载和初始化.

Recently, I upgraded to Emacs 24.1.1 which was realeased on 6/10/2012 and I have been trying to use the built-in package system and have installed several packages using it, but they all have a similar problem related to autoload and initialization.

例如,我使用一个名为 smex 的包,它提供了使用 M-x 和弦的增强功能.它要求你为 Mx 定义一个键,所以我在我的 init.el 中添加了 (global-set-key (kbd "Mx") 'smex) 文件.但是在启动 emacs 后,我按下 Mx 和弦,然后我收到消息 Symbol 的函数定义是无效的:smex" ...如果我也把 (require 'smex) 在我的 init.el 文件中,我收到错误消息 文件错误:无法打开加载文件,smex"

For example, I use a package called smex which provides enhancements for using the M-x chord. It requires you to define a key for M-x, so I added (global-set-key (kbd "M-x") 'smex) in my init.el file. But after starting emacs I press the M-x chord and I get the message "Symbol's function definition is void: smex" ... If I also put (require 'smex) in my init.el file I get the error message "File error: Cannot open load file, smex"

将 smex 的位置添加到 load-path 变量使其按预期工作,但是,这似乎首先破坏了拥有包系统的全部目的......

Adding the location of smex to the load-path variable makes it work as expected, however, that seems to defeat the whole purpose of having a package system in the first place...

有什么想法吗?有没有更好的方法,或者我们现在是否忍受这种限制?

Any thoughts? Is there a better way or do we live with this limitation for now?

推荐答案

您使用 package.el 安装的软件包默认在在您的 之后激活.emacs 已加载.为了能够在 .emacs 结束之前使用它们,您需要使用以下命令激活它们:

The packages that you install with package.el are activated by default after your .emacs is loaded. To be able to use them before the end of your .emacs you need to activate them by using the commands:

(setq package-enable-at-startup nil)
(package-initialize)

这篇关于Emacs 24 包系统初始化问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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