我在哪里可以找到在 Windows 上运行的 Emacs 的 .emacs 文件?
我尝试为 Emacs 的 Windows 安装寻找 .emacs 文件,但我找不到它.Windows 下的文件名和 Unix 下的文件名一样吗?
I tried looking for the .emacs file for my Windows installation for Emacs, but I could not find it. Does it have the same filename under Windows as in Unix?
我必须自己创建吗?如果有,具体在哪个目录下?
Do I have to create it myself? If so, under what specific directory does it go?
从 Emacs FAQ 中复制并粘贴,http://www.gnu.org/software/emacs/windows/:
Copy and pasted from the Emacs FAQ, http://www.gnu.org/software/emacs/windows/:
在 Windows 上,.emacs
文件可能被称为 _emacs
以向后兼容 DOS 和 FAT 文件系统,其中文件名不能以点开头.一些用户更喜欢继续使用这样的名称,因为 Windows Explorer 无法创建名称以点开头的文件,即使文件系统和大多数其他程序可以处理它.在 Emacs 22 及更高版本中,init 文件也可能被称为 .emacs.d/init.el
.许多由 Lisp 包创建的其他文件现在也存储在 .emacs.d
目录中,因此这将所有与 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 Windows 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.d
directory too, so this keeps all your Emacs related files in one place.
上面提到的所有文件都应该放在您的 HOME 目录中.HOME 目录通过以下步骤确定:
All the files mentioned above should go in your HOME directory. The HOME directory is determined by following the steps below:
- 如果设置了环境变量 HOME,请使用它指示的目录.
- 如果设置了注册表项 HKCUSOFTWAREGNUEmacsHOME,请使用它指示的目录.
- 如果设置了注册表项 HKLMSOFTWAREGNUEmacsHOME,请使用它指示的目录.不推荐,因为这会导致用户共享相同的 HOME 目录.
- 如果
C:.emacs
存在,则使用C:/
.这是为了向后兼容,因为如果未设置 HOME,以前的版本默认为C:/
. - 使用用户的 AppData 目录,通常是用户配置文件目录下的 Application Data 目录,其位置因 Windows 版本和计算机是否属于域而异.
- If the environment variable HOME is set, use the directory it indicates.
- If the registry entry HKCUSOFTWAREGNUEmacsHOME is set, use the directory it indicates.
- If the registry entry HKLMSOFTWAREGNUEmacsHOME is set, use the directory it indicates. Not recommended, as it results in users sharing the same HOME directory.
- If
C:.emacs
exists, then useC:/
. This is for backward compatibility, as previous versions defaulted toC:/
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.
在 Emacs 中,文件名开头的 ~
被扩展到你的 HOME 目录,所以你总是可以用 Cx Cf ~/.emacs
找到你的 .emacs 文件>.
Within Emacs, ~
at the beginning of a file name is expanded to your HOME directory, so you can always find your .emacs file with C-x C-f ~/.emacs
.