I went through the documentation of both the function but they don't seem to shed much information. What is the actual difference between them apart from the fact that load is a built-in function in C source code whereas load-file is an interactive list compiled function.

What is the recommended function to use in init.el since both seem to be doing the same job ?

  • 2
    What part of the documentation for this was not clear in this regard? Consider reporting the doc problem, if you really think there is one: M-x report-emacs-bug. As @shosti says, and as the doc clearly indicates, load-file "does not use load-path, and does not append suffixes", for two important differences.
    – Drew
    Commented Nov 9, 2014 at 2:15
  • See also the Emacs manual, node Lisp Libraries.
    – Drew
    Commented Mar 24, 2017 at 23:19

2 Answers 2


There are several ways to load Lisp files in Emacs:

  1. load-file takes a literal filename (relative or absolute) and loads the code. Example: (load-file "/usr/local/share/site-lisp/foo.el")
  2. load is like load-file, except that it is more flexible--you can leave out the extension and it will automatically load the "elc" or "el" file as appropriate.
    It also looks into the load-path directories.
    Example: (load "foo") (if "foo.el" is in the current directory or in the load-path").
  3. load-library is an interactive interface for load.
  4. require is similar to load, except it prevents the file from being loaded more than once (it also requires a corresponding provide statement at the end of the file in question). Example: (require 'foo)
  • 3
    Your require example is a load example. ;-)
    – Drew
    Commented Nov 9, 2014 at 2:10
  • The load-file example uses load. :)
    – itsjeyd
    Commented Nov 9, 2014 at 9:57
  • 2
    Sorry to say 2 and 3 were wrong. :-) load does look into the load-path.
    – Malabarba
    Commented Nov 10, 2014 at 11:51
  • @Malabarba Oops, you're right, thanks for the correction. That is more confusing than I thought.
    – shosti
    Commented Nov 10, 2014 at 15:58

load-file and load-library are commands for interactive use (where the main difference is in the initial content of the prompt).

load is the underlying function to use when you write Elisp (such as in your .emacs).

  • 2
    :D Your answer exactly explains the suggestions in The GNU Emacs FAQ: “You can use M-x load-file to have Emacs evaluate all the Lisp forms in a file. (To do this from Lisp use the function load instead.)”
    – shynur
    Commented Feb 17, 2023 at 22:09

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.