My .emacs file includes a line I presumably added ages ago

(require 'some-random-package)

I haven't actually been able to learn anything about the package.

My load-path is quite complicated (it takes up about a screenful) so a manual solution digging through the load path isn't ideal.

I'm aware emacs' rules for loading a package are to look through the directories in the load path for foo.elc and foo. How can I find where the package came from?

  • 2
    How about?: locate-library [to see the path] or find-library [to open the library in a buffer]
    – lawlist
    Commented Apr 1, 2015 at 0:28
  • possible duplicate of How to visit file containing source code for a given function?. As explained in this solution to that question, using the elisp-slime-nav package, simply put the point over some-random-package in that require statement and hit M-. Commented Apr 1, 2015 at 3:40
  • Also, if your installed packages exist on one of the repositories like Melpa or GNU Elpa, then you don't have to manually populate load-path; make use of the package manager to install packages and do (package-initialize). Package installation how-to from Xah Lee's blog. Commented Apr 1, 2015 at 3:46
  • @lawlist You should post your comment as an answer. I don't think this question is a real duplicate of How to visit file containing source code for a given function? as it focuses on packages instead of functions; also, OP seems to be more interested in seeing the path than actually jumping to the library.
    – itsjeyd
    Commented Apr 9, 2015 at 11:56

1 Answer 1


There are two built-in interactive functions to help a user track down a library that is within the load-path -- i.e., locate-library [to see the path] and find-library [to open the library in a buffer].

M-x locate-library

locate-library is an interactive compiled Lisp function in 'subr.el'.


Show the precise file name of Emacs library LIBRARY.
LIBRARY should be a relative file name of the library, a string.
It can omit the suffix (a.k.a. file-name extension) if NOSUFFIX is
nil (which is the default, see below).
This command searches the directories in 'load-path' like 'M-x load-library'
to find the file that 'M-x load-library RET LIBRARY RET' would load.
Optional second arg NOSUFFIX non-nil means don't add suffixes 'load-suffixes'
to the specified name LIBRARY.

If the optional third arg PATH is specified, that list of directories
is used instead of 'load-path'.

When called from a program, the file name is normally returned as a
string.  When run interactively, the argument INTERACTIVE-CALL is t,
and the file name is displayed in the echo area.

M-x find-library

find-library is an interactive autoloaded compiled Lisp function in

(find-library LIBRARY)

Find the Emacs Lisp source of LIBRARY.
LIBRARY should be a string (the name of the library).

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.