1

Is there a way to list definitions for a package? (functions, macros, variables for e.g.).

Once a package is loaded, is there a way to retrieve a list of what it defined?


So for example: (list-symbols-for-package 'subr) would return a list including ('declare-function 'lambda 'setq-local ...) and many others.

1 Answer 1

4

Emacs keeps track of where each symbol is defined in load-history. This is an association list from file paths to the list of symbols defined in each path, with annotations indicating whether the symbol is a variable, a function, etc. The function file-loadhist-lookup returns the load-history entry for a given file, e.g. (file-loadhist-lookup "subr"). This is an internal function of the loadhist module, not autoloaded, so you need to (require 'loadhist) first.

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.