Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Emacs default directory

I have the following statement in two installations of emacs

(setq default-directory "~/.emacs.d/") 

followed by

(load-file "keyboard.el")  

One installation finds the file, the other doesn't. I have to add the directory beforehand for it to be loaded.

What could be the problem?

How would I display default-directory in init.el to see if it is being set properly?

P.S. : I'm very much finding my way around the system, so excuse the dumb question.

Answer*

Cancel
2
  • I'm fairly new to all this and thought I needed to set default-directory so that emacs could find lisp files referred to. Will they automatically load if they are in ~/.emacs.d ? Commented Sep 1, 2023 at 21:03
  • Variable load-path is a list of directories that Emacs will look in, to find Lisp files when you use require or load-library. If ~/.emacs.d is in your load-path then anything in that directory (but not below it) will be found. Commented Sep 1, 2023 at 21:39