在加载路径中禁用关于emacs.d的警告 [英] Disable warning about emacs.d in load path

查看:99
本文介绍了在加载路径中禁用关于emacs.d的警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最新版本的 emacs (从 24.3.50 快照)启动时出现 .emacs.d 恰好在加载路径中。

 警告(初始化):你的`load-path'似乎包含
你的`.emacs.d'目录:〜/ .emacs.d /
这可能会导致问题...
考虑使用子目录代替,例如:/home/adriean/.emacs.d/lisp

有没有办法禁用这个警告?



(因为我想保持我的emacs.d在加载路径,现在作为一个快速暴力黑客我去了(setq warning-minimum-level:error),但我宁愿尽快摆脱这个问题。 p>

解决方案

不要禁用警告。这是一个很好的理由:〜/ .emacs.d 不应该在你的加载路径中。 / p>

这是因为Emacs将文件写入此目录,因此这些文件可能( elisp库。如果您的加载路径中有此目录,并且您有这样的名称冲突,那么如果需要该库,Emacs将尝试加载错误的文件。



只需更改你的配置将您将该目录中放置的elisp库移动到子目录中,然后更新将〜/ .emacs.d 添加到您的加载项的代码是微不足道的-path,以便它添加新的子目录:

 (add-to-list'load-path -file-name〜/ .emacs.d / lisp))


In latest version of ̀emacs ( from 24.3.50 snapshot) there is a warning at startup when .emacs.d happens to be in the load path.

Warning (initialization): Your `load-path' seems to contain
your `.emacs.d' directory: ~/.emacs.d/
This is likely to cause problems...
Consider using a subdirectory instead, e.g.: /home/adriean/.emacs.d/lisp

Is there a way to disable just this warning?

(since I wanna keep my emacs.d in the load path, for now as a quick brute hack I went for (setq warning-minimum-level :error), but I would prefer to get rid of this as soon as possible)

解决方案

Don't disable the warning. It's there for a good reason: ~/.emacs.d shouldn't be in your load-path.

This is because Emacs writes files to this directory, and therefore it's possible (there are existing cases) for those files to conflict with the names of elisp libraries. If you have this directory in your load path, and you have such a name clash, then Emacs will attempt to load the wrong file if that library is required.

Just change your configuration. It's trivial to move the elisp libraries you've placed in that directory into a sub-directory, and then update the code which was adding ~/.emacs.d to your load-path, so that it adds the new sub-directory instead:

(add-to-list 'load-path (expand-file-name "~/.emacs.d/lisp"))

这篇关于在加载路径中禁用关于emacs.d的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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