I would like Emacs to open the folder $HOME/Documents/CodeLite/CPP-Math-Projects/Simple-Pendulum on startup and show it in the directory browser. Is there a way to do this? I have read https://www.gnu.org/software/emacs/manual/html_node/elisp/Startup-Summary.html, but it is too abstract for me to follow, given the fact I am fairly unconfident with Emacs Lisp.


Oops, never mind, I read the link I provided earlier again and I finally got how to turn it into an ~/.emacs modification. Specifically I added:

(setq initial-buffer-choice "~/Documents/CodeLite/CPP-Math-Projects/Simple-Pendulum")

to my ~/.emacs file.


If you are on MS Windows, consider using this simple way:

Create a Windows shortcut, with:

  • runemacs.exe (with its path), in field Target. Include any command-line switches you like - e.g., D:\Emacs-25.1\bin\runemacs.exe --debug-init
  • The directory you want Emacs to start in, in field Start in.

You can also have Emacs start out by visiting that directory in Dired. To do that, just add the directory at the end of field Target.

Then, to start Emacs, just double-click your shortcut.

  • Na, I use Linux and only Linux. But I know how to create a desktop config file to open emacs to whichever folder I want. I just prefer a config file adjustment.
    – Josh Pinto
    Oct 3 '16 at 16:12

To open a directory at startup you can also insert (find-file "/path/to/dir") in init.el

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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