I am trying to set the default directory to D:/ by

(setq default-directory "D:/")

but when I type c-x c-f, it is showing D:\software\emacs\bin, which is the installation directory.

  • default-directory is buffer-local. I suspect you are running that code in your init file, and imagining it will affect all buffers, but that is incorrect. What is your goal (in detail)? – phils Dec 16 '17 at 10:48
  • My goal is to go to default directory, in my case D:/ where I have D:/Documents, D:/programs, etc., folders. Now, I have type it manually by removing the D:/software/emacs/bin directory, which I feel little bit boring. Yes, I want to run this code in init-file. Is there any other options? – Sreekumar R Dec 16 '17 at 10:50

The issue is indeed likely the same as the one in Setting default-directory does not change find-file directory but here's a "solution" for your specific case:

C-x C-f shows you say D:/software/emacs/bin/ and you want to open, say, D:/Documents/mynotes.org, then just type something like /d/mynot TAB RET and you should be done. This is because // in this kind of file prompt is treated to mean "ignore everything before the //". Just typing / should already make this clear by coloring the /software/emacs/bin/ in grey.

Not the answer you're looking for? Browse other questions tagged or ask your own question.