Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!ncar!boulder!uswat!jbw From: jbw@zeb.uswest.com (Joe Wells) Newsgroups: comp.emacs Subject: Re: Why can't I set default-directory ? Message-ID: Date: 12 Aug 90 00:28:47 GMT References: Sender: news@uswat.UUCP Organization: U S West Advanced Technologies Lines: 43 In-reply-to: cje@elbereth.rutgers.edu's message of 10 Aug 90 18:50:20 GMT cje@elbereth.rutgers.edu (Cthulhu's Jersey Epopt) writes: If I run an emacs session from my main directory, whenever I use find-file or visit-file, it assumes the file's in that directory. If I want to go to a file in a subdirectory, I just add the subdir to the dir tree in the file name. All well and good. [stuff deleted here] But all this stuff is apparently stored in the default-directory variable. Emacs will happily change the value of d-d if I edit the minibuffer, but it won't let me change it via set-variable -- it doesn't recognize d-d (though describe-variable does). There is a separate value of default-directory for each Emacs buffer. When you start Emacs, the value of default-directory for the *scratch* buffer is taken from the value of the PWD environment variable or from the current directory of the process from which you started Emacs. The default directory of the *scratch* buffer is used for finding files you specify on the command line. Why can't I set this directly? (I guess I'm envisioning setting keys that will switch to commonly used directories such as .../tex .) You mean set it directly using set-variable? set-variable uses read-variable to get the name of the variable from the user. And according to the documentation for read-variable, it won't accept the names of variables that are not considered "user variables": read-variable: One arg PROMPT, a string. Read the name of a user variable and return it as a symbol. Prompts with PROMPT. A user variable is one whose documentation starts with a "*" character. There is however, a convenient interface provided to change the default directory for the current-buffer. Simply use the cd command (invoked by M-x cd): cd: Make DIR become the current buffer's default directory. -- Joe Wells