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

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

问题描述

在我看来,在Emacs 24中内置的新的Package系统在正确加载和初始化安装的软件包方面有一些缺陷。



最近,我升级到Emacs 24.1.1,该功能于2012年6月6日重新发布,我一直在尝试使用内置软件包系统,并安装了几个使用它的包,但它们都有与自动加载和初始化相关的类似问题。



例如,我使用一个名为 smex 的软件包,它提供了使用 Mx 和弦。它需要您为 Mx 定义一个密钥,所以我添加了(global-set-key(kbdMx)'smex)我的 init.el 文件。但是,在启动emacs之后,我按下 Mx 和弦,我收到消息符号的函数定义为void:smex ...如果我也放我的init.el文件中的(require'smex)我收到错误信息文件错误:无法打开加载文件,smex



将smex的位置添加到load-path变量使其按预期工作,但是,似乎打破了首先在一个包系统中的整个目的...



任何想法?有没有更好的方法或者我们现在有这个限制吗?

解决方案

使用 package.el 在之后默认激活, .emacs 被加载。
为了能够在你的 .emacs 结束之前使用它们,您需要使用以下命令激活它们:

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


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.

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.

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"

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?

解决方案

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天全站免登陆