开发者

Change the initial directory on emacs, and also some tips for a starter

How can I change the initial directory on emacs? I started us开发者_开发知识库ing it today and there are a lot of things to learn!

Right now I'm using M-X cd and then I change the directory that I use for C-x C-f, but in a daily work I'm going to heavily use one particular directory so I need to make the change permanent.

Also if you have some tips for a starter it will be nice.


To set a default directory, simply put

(cd "/default/path/")

in your ~/.emacs file.

Emacs has a steep learning curve, but with constant use the most common commands will soon become second nature. As you discover more, emacs may become your favorite text editor, file manager, and email reader :)

To learn emacs, I'd start by pressing C-h t to start plowing through the excellent tutorial. Have a pad of paper beside you and write down the commands as you learn them. You'll use the crib sheet at first, but after a while, as I mentioned before, your fingers will learn the key combinations without your brain conciously intervening.

Good luck and have fun!


Default directory is determined by:

(setq default-directory "~/")

in this case, set to the users home dir, but it could be somewhere else.

If this variable is not set, the initial load point for find-file will be the directory where the emacs executable lives.

EDIT: on windows, a global HOME environment variable can be defined (HOME=c:\path\to\user\home\directory), ensuring that Emacs translates ~ to the correct value. This makes the Emacs settings usable across platforms.


Start up emacs only after changing to that "initial directory", effectively setting the current directory for emacs.


This is a solution specific to Windows.

  1. Create a shortcut to emacs.exe" called GNU Emacs
  2. Open Properties on the GNU Emacs shortcut
  3. Set Start in to %USERPROFILE%\Documents

This solution works for multi-user workstations whether they are on or off Active Directory.

This shortcut will start Emacs in the current user's Documents folder.


Print out the Gnu Emacs Reference card and keep it by the desk.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜