1.安装
1、 emacs官网获取安装程序:
http://www.gnu.org/software/emacs/
2.、GNU Emacs for Windows can be downloaded from a nearby GNU mirror; or the main GNU FTP server.
Unzip the zip file preserving the directory structure, and run bin\runemacs.exe
. Alternatively, create a desktop shortcut to bin\runemacs.exe
, and start Emacs by double-clicking on that shortcut's icon
3、配置文件路径配置
官方说明:
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 Data under the user's profile directory, the location of which varies according to Windows version and whether the computer is part of a domain.
参考:https://blog.csdn.net/lihenair/article/details/19050479
方法一:原文:https://blog.csdn.net/zhuxiaoyang2000/article/details/8819601
默认情况下,Windows系统中Emacs的配置文件.emacs在C:\Users\
启动emacs,在 Option 菜单中随便更改一下设置,如 取消Ignore Case for Search,之后点 Save Options。这一步不是多余的哦,因为默认情况下emacs不会在一启动的时候就生成 .emacs 配置文件和 .emacs.d目录的。这步生成的 .emacs 目录还是在 C:\Users\
下面就进入关键步骤了,打开 C:\Users\
(load-file "D:/OpenSource/emacs-24.3/.emacs")
(注意用“/”而非“\”,否则Emacs不能正确识别)这个配置意思很明显了,emacs在启动的时候会加载 C:/Users/
上一步,我们把emacs的配置文件用 (load-file ...) 配置已经指向到 D:/OpenSource/emacs-24.3/.emacs 了,那就拷贝 .emacs 文件放到 D:/OpenSource/emacs-24.3/ 里吧(Windows下好像不能建立以 . 开头的文件吧)。然后,打开D:/OpenSource/emacs-23.2/.emacs,在开头添加如下配置:
(setenv "HOME" "D:/OpenSource/emacs-24.3")
(setenv "PATH" "D:/OpenSource/emacs-24.3")
;;set the default file path
(setq default-directory "~/")
恩,是的,这里重新给 HOME PATH 等定义了新的路径~~~写到这里大家该明白了,就是把配置转移了一下而已。
好了,现在就可以了把 D:/OpenSource/emacs-24.3 当成emacs的 HOME了。
方法二:
打开注册表,找到HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs(如果没有则手动添加项), 在此项下添加字符串值,名称为HOME,值为D:\Emacs23.2。这样做的目的是让D:\Emacs23.2成为Emacs的home路径(传说中 的home path,以后你将会经常看到“home目录”、“home directory”等等)。
4、创建配置文件.emacs.d目录和.emacs文件(.emacs文件的优先级更高)
相信.emacs.d目录和.emacs文件是困扰大家很久的问题了,其实有个简单的办法 可以解决此问题。启动emacs(注:win7系统需要右键“以管理员身份运行”),用鼠标点击Options菜单,随便点击一两个选项,比如点击一下Active Region Highlighting,然后点击Save Options。先不要担心你会破坏了什么东西,这样做的目的是让emacs自动创建.emacs.d目录以及.emacs文件!观察你的Emacs窗口 最后一行,是否显示“Wrote D:/Emacs23.2/.emacs”?如果是的话就对了,当你选择Save Options的时候,Emacs会在home路径下产生.emacs文件,并把配置信息写进这个文件。D:\Emacs23.2\目录下将会产生这两个文件。