windows系统中Emacs的HOME目录及配置文件的正确路径
来源:互联网 发布:出世 入世 知乎 编辑:程序博客网 时间:2024/06/05 20:15
最近爱折腾的毛病又犯了,开始折腾起Emacs,在自定义Emacs的配置文件存放位置时遇到一点问题,不过,在GNU的Emacs站 点,看到这么一段话:
On Windows, the .emacs file may be called _emacs for backward compatibility with DOS and FAT filesystems where filenames could not start with a dot. Some users prefer to continue using such a name, because Explorer cannot create a file with a name starting with a dot, even though the filesystem and most other programs can handle it. In Emacs 22 and later, the init file may also be called.emacs.d/init.el. Many of the other files that are created by lisp packages are now stored in the.emacs.ddirectory too, so this keeps all your Emacs related files in one place.
All the files mentioned above should go in your HOME directory. The HOME directory is determined by following the steps below:
- If the environment variableHOME is set, use the directory it indicates.
- If the registry entry
HKCU\SOFTWARE\GNU\Emacs\HOME
is set, use the directory it indicates.- If the registry entry
HKLM\SOFTWARE\GNU\Emacs\HOME
is set, use the directory it indicates. Not recommended, as it results in users sharing the same HOME directory.- If C:\.emacs exists, then use C:/. This is for backward compatibility, as previous versions defaulted to C:/if HOME was not set.
- Use the user's AppData directory, usually a directory called Application Dataunder the user's profile directory, the location of which varies according to Windows version and whether the computer is part of a domain.
也就是说,Emacs的配置文件有三种格式:.emacs文件、_emacs文件或者.emacs.d目录下的init.el(22或 者更高版本)文件,但是,不管哪种格式,必须放对正确的目录Emacs才能找到,这个正确的目录就是HOME目录。
熟悉Linux的朋友一般都知道home目录,简单的用~表示,或者用全路径表示为/home/<xxx>,其中xxx表示 用 户名字,所以,在Linux下将.emacs和.emacs.d放到这个目录下就行了,但windows没有home目录的概念,所 以,Emacs就按如 下方式来查找配置文件:
- 如果设置了HOME环境变量,那么就用它的值作为home目录~
- 如果存在注册表键值HKCU\SOFTWARE\GNU\Emacs\HOME,就用它的值作为home目录~
- 如果存在注册表键值HKLM\SOFTWARE\GNU\Emacs\HOME,就用它的值作为home目录~(和2的区别 是,2只是针对当前用户的注册表路径,3则是针对所有用户)
- 如果存在C:\.emacs,就用C:\作为home目录~
- 如果以上都不存在的话,就使用<system root>\Users\<user name>\AppData\Roaming作为home目录~(对于XP和较早windows用户,需要到Documents and Settings目录下去找)
从以上策略来看,1是 比较好的做法,所以优先级也最高,应该是属于建议的方式,于是,新建一个HOME环境变量,将它的值设为想要放置Emacs配置 文件的地方既可。
之前我是按以上方法设置的HOME目录,不过现在我后悔了,因为我发现不光是Emacs会使用HOME这个环境变量, 会使用这个变量的至少还有以下程序或者插件:
- VIM,VIM会把_viminfo文件放在这个目录;
- VIM的neocomplcache插件,它会放置一个.neocon目录进去;
- firefox的pentadactyl插件,它会放一个pentadactyl目录进去。
所以,个人建议:
- 如果你希望有一个公共的目录存放这些配置,就像 Linux下的~目录一样,那么设置HOME这个环境变量最适合不过;
- 如果你希望这个目录只存放Emacs的配置,那 么,还是不要用HOME环境变量了,去注册表里面添加一个HOME键值吧。(至少我个人比较偏向于这个方式)
原文: http://www.cnblogs.com/ini_always/archive/2012/04/27/2472857.html
- windows系统中Emacs的HOME目录及配置文件的正确路径
- windows系统中Emacs的HOME目录及配置文件的正确路径
- Windows下设置Emacs的HOME目录
- Windows下设置Emacs的HOME目录
- Windows下设置Emacs的HOME目录
- WinXP下Emacs的HOME目录、项目文档路径设置
- Emacs-003-Windows下寻找Emacs配置文件的默认存储目录
- windows 新建一个Emacs的配置文件
- 我的Emacs配置文件 (windows版)
- ,如%USERPROFILE% 指当前用户的配置文件目录 系统路径%ProgramFiles% %windir% %windows% %Temp% 等的解释
- Emacs 24.2在WINDOWS中的安装及Color-theme的正确配置
- Windows下Emacs设置配置文件路径
- Windows下如何解决git bash的默认home目录路径问题
- Emacs中使用purcell大师的配置文件
- 我的emacs配置文件
- emacs的配置文件
- 我的 Emacs 配置文件
- 我的 .emacs配置文件
- Gson使用笔记
- margin 属性 padding属性 div属性
- 小米人APK改之理(Apk IDE)介绍
- android view 框架
- spring mvc 之 HandlerMapping 配置
- windows系统中Emacs的HOME目录及配置文件的正确路径
- VMware8+ubuntu10.04+hadoop0.20.203配置实践细节说明
- Storm学习1-环境安装
- win7下的输入telnet
- 超全的matlab绘图实例及代码(曲线,曲面,饼状图,柱形图,网格图,球面等)
- 编程之美读书笔记2.8—找符合条件的整数
- Linux下SVN部署Web版本同步
- 【PyQt4 实例30】改变鼠标形状
- 字符串按指定字节数截取、隐藏与显示输入软键盘、收起状态栏以及判断服务是否运行功能代码段