unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Carlos Gomes'" <cgomes.cami@gmail.com>, <help-gnu-emacs@gnu.org>
Subject: RE: Changing the default directory in which emacs save the files
Date: Wed, 16 Jul 2008 15:10:24 -0700	[thread overview]
Message-ID: <000701c8e790$bf292230$c2b22382@us.oracle.com> (raw)
In-Reply-To: <74c0c290807160928r38aa9bd9y501756b021ee09c5@mail.gmail.com>

> I have GNU Emacs installed in my computer on both windows
> and linux operative systems, and I have been looking for
> a way that allows me to change the directory in which emacs
> saves the files that I am working with. That is, is there a
> way to "tell" emacs to save a file in a directory other
> than, for instance, C:\Programs\emacs\bin (the default) in
> windows, by using the command C-x C-s (save-buffer)?

At any time (in any buffer), there is a default directory, whose full name is
the value of variable `default-directory'. Many operations that use file names
interpret a file whose name you enter, by default, as belonging to the current
default directory.

So when you use `C-x C-s', for instance, if the current buffer is not already
associated with a file, then you are prompted for a file in the default
directory, which appears in the minibuffer: "File to save in: c:/toto/titi/".

You can change the default directory at any time, using command `cd' - e.g.,
`M-x cd RET', then enter the directory at the prompt "Change default directory:
".

When you start Emacs, `default-directory' is, by default, the directory where
the Emacs executable is located - e.g. c:\emacs\bin\. On Windows, you can set
the Emacs start-up directory to be something different, as follows:

1. Create a shortcut to the Emacs exectutable file runemacs.exe.
2. Right click the shortcut, and choose Properties.
3. Put the directory you want in the field "Start in:"
   - e.g., c:\my\directory.
4. (Optional) If you want Emacs to open in Dired on that directory,
   then also append it, within double quotes, to the "Target:" value
   - e.g., c:\emacs\bin\runemacs.exe "c:\my\directory".

Then, to open Emacs, just double-click the shortcut.

Alternatively, and for Linux also, you can set environment variable `PWD' to the
directory you want Emacs to start in (that is, the default value of
`default-directory').






  parent reply	other threads:[~2008-07-16 22:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-16 16:28 Changing the default directory in which emacs save the files Carlos Gomes
2008-07-16 21:58 ` Lennart Borgman (gmail)
2008-07-16 22:10 ` Drew Adams [this message]
2008-07-16 22:12 ` Charles philip Chan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000701c8e790$bf292230$c2b22382@us.oracle.com' \
    --to=drew.adams@oracle.com \
    --cc=cgomes.cami@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).