Usually there are many .el files in the folders with the name lisp in the installation directory of Emacs. At start-up, Emacs doesn't load all these files, in consequence a command like M-x calendar-print-day-of-year in only accessible after loading calendar.el or doing M-x calendar.

Is it possible to load all .el files (found at lisp subdirectories) at Emacs' start-up?

The motivation is that there are situations where it would be desirable that that all commands to be at disposal.

  • 4
    I think you shouldn't do it. Who knows what lies there and how it should be loaded. When you know you need calendar-print-day-of-year -- just add (require 'calendar) in ~/.emacs. – Adobe Jan 21 '15 at 14:10
  • @Adobe calendar.el was just an example. My question was about how to load everything. The question is not about whether I should do it or no. It was about how to do it. – Name Jan 21 '15 at 14:14
  • Name: Sometimes people ask how to do a generally-unwise thing because they're not aware of the alternatives, and the best answer is to guide them in a different direction. In a case like this, it would be helpful to provide an example of why you want to take the extreme measure of loading all elisp libraries (e.g. you want temporary access within Emacs to all available function documentation), as "situations where it would be desirable" is awfully vague. – phils Jan 21 '15 at 20:59

The answer is rather trivial:

(mapc 'load (file-expand-wildcards "~/some-lisp-files/*.el"))

But as suggested above, it's always better to load just the code you are certain of, not even because it's more secure to do so, but because it could be too annoying to debug it if you introduce an accidental change etc. Worse yet, if some of those files contain code which deletes some files you might not want to delete, or does some other things, which you generally don't want to happen automatically.

If anything, I'd go with something like this:

  1. Open Dired buffer in the directory you want to load files from.
  2. Maybe open recursively other directories with other Lisp files, or search Dired to get a list of files you want to load, using i for insert or M-xfind-dired to search.
  3. Mark the files you actually want to load with commands like t or m or using masks * %.
  4. l to load all marked files.

Also, note that this will actually load the files (as per the title of your question), but you are more likely to be interested in require. This will also automatically load the proper version (either the source or the byte-compiled one). Also, it will take care of the proper loading order. But, you will have to spell out what exactly you want to require.


Loading all the files in Emacs's lisp directory is currently unsafe: some of those files (like the w32-*.el) are only meant to be used for a particular platform and will break your session in various ways when used on another platform.

Feel to try it, tho, because I consider such breakage to be bugs, and indeed, I've bumped into several of them, and have fixed some of those I encountered: in principle it should be safe to do it.

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.