mjsr
mjsr

Reputation: 7590

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

How can I change the initial directory on emacs? I started using 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.

Upvotes: 2

Views: 5389

Answers (5)

klang
klang

Reputation: 524

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.

Upvotes: 3

Alain O'Dea
Alain O'Dea

Reputation: 21686

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.

Upvotes: 2

ndim
ndim

Reputation: 37747

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

Upvotes: 1

Paul Nathan
Paul Nathan

Reputation: 40299

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

Upvotes: 0

unutbu
unutbu

Reputation: 879083

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!

Upvotes: 9

Related Questions