Let’s say, I have emacs on Windows. What I would like to do is to run emacs from the cmd and have my startup directory as default directory in emacs.
I already put the emacs dir into my PATH variable, so I am able to execute ‘runemacs’ from anywhere in my cmd. But the default directory in emacs does not equal to the startup directory of emacs. C-x C-f still points me to ‘c:\emacs’ which, in turn, is specified in emacs config
(setq default-directory “C:/emacs”).
What should I do to have default directory pointing to the startup directory?
You could do something like this:
In your .emacs file, and create an alias for
emacs -cwd, or, if I understand it correct, on Windows it would berunemacs -cwd. Also, iirc, on Windows it’s CWD, not PWD. Well, the meaning of this piece of code is:-cwd.default-directoryto whatever it is.