I use a package called Deft that needs a directory to store and load files. To define this directory on Mac or GNU/Linux I use the following expression:

(setq deft-directory "~/Dropbox/org")

When using Emacs on Windows shall I change every ~ to C:\\Users\\sbac and every / to \\ as in:

(setq deft-directory "C:\\Users\\sbac\\Dropbox\\org")
  • Note that M-: (expand-file-name "~/Dropbox/org") will show you which path that expands to.
    – phils
    Mar 31, 2020 at 20:05

1 Answer 1


No. Emacs on MS Windows uses the GNU/Unix conventions of ~ and / as directory separator, just fine.

See also the Emacs manual, nodes Minibuffer File and Windows HOME.

(And on MS Windows be sure to define environment variable HOME.)

  • OK. But when I use (setq deft-directory "~/Dropbox/org") and then Alt-X Deft I receive the message Directory ~/Dropbox/org does not exist. But this directory exists.
    – sbac
    Mar 31, 2020 at 17:44
  • I have no idea what variable deft-directory is, or what command Deft is, which means the question is incomplete. Did you perhaps mean standard variable default-directory?
    – Drew
    Mar 31, 2020 at 17:50
  • I use a package called Deft. Anyway, reading your Windows HOME link I think that Emacs thinks that my home directory is different from C:\Users\sbac.
    – sbac
    Mar 31, 2020 at 17:54
  • Yes, on MS Windows you will want to define environment variable HOME.
    – Drew
    Mar 31, 2020 at 17:57
  • I have edited my post. How to define HOME on Windows is a subject of a different question.
    – sbac
    Mar 31, 2020 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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