问题描述
我对Emacs来说相当新鲜,我一直在试图找出如何在启动时更改的默认文件夹。例如,当我首次加载Emacs并命中时,其默认文件夹为 C:\emacs\emacs-21.3\bin
,但我宁愿它是桌面。我相信有一些方法可以自定义 .emacs
文件来执行此操作,但我仍然不确定是什么。 更新:我发现这个问题有三种解决办法,但是我认为解决方案3只是Windows。
- (cdC:/ Users / Name / Desktop)添加到
.emacs
文件 -
解决方案2:添加
(setq default-directoryC:/ Documents and Settings / USER_NAME / Desktop /)
到.emacs
文件 -
解决方案3:右键单击Emacs快捷方式,点击属性并将字段中的开头更改为所需的目录。
你没有这么说,但是听起来你正在从Windows快捷方式启动Emacs。
使用cx cf看到的目录是Emacs中的cwd条款, default-directory
(一个变量)。
当您启动Emacs usi使用MS Windows快捷方式, default-directory
最初是快捷方式属性的开始字段中指定的文件夹(目录)。右键单击快捷方式,选择属性
,然后在 Start In
字段中键入桌面路径。
如果您从命令行使用Emacs, default-directory
开始作为启动Emacs的目录(cwd )
这种方法比编辑.emacs文件更好,因为它将允许您有多个启动目录的多个快捷方式,它可以让您如果需要,请具有Emacs的正常命令行行为。
CWD = = PWD = 。在命令行上比GUI更有意义。
I am fairly new to Emacs and I have been trying to figure out how to change the default folder for on start-up. For instance when I first load Emacs and hit its default folder is C:\emacs\emacs-21.3\bin
, but I would rather it be the desktop. I believe there is some way to customize the .emacs
file to do this, but I am still unsure what that is.
Update: There are three solutions to the problem that I found to work, however I believe solution 3 is Windows only.
Solution 1: Add
(cd "C:/Users/Name/Desktop")
to the.emacs
fileSolution 2: Add
(setq default-directory "C:/Documents and Settings/USER_NAME/Desktop/")
to the.emacs
fileSolution 3: Right click the Emacs short cut, hit properties and change the start in field to the desired directory.
You didn't say so, but it sounds like you're starting Emacs from a Windows shortcut.
The directory that you see with c-x c-f is the cwd, in Emacs terms, the default-directory
(a variable).
When you start Emacs using an MS Windows shortcut, the default-directory
is initially the folder (directory) specified in the "Start In" field of the shortcut properties. Right click the shortcut, select Properties
, and type the path to your desktop in the Start In
field.
If you're using Emacs from the command line, default-directory
starts as the directory where you started Emacs (the cwd).
This approach is better than editing your .emacs file, since it will allow you to have more than one shortcuts with more than one starting directory, and it lets you have the normal command line behavior of Emacs if you need it.
CWD = current working directory = PWD = present working directory. It makes a lot more sense at the command line than in a GUI.
这篇关于更改Emacs中的默认文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!