ElispDepend is mode that parses an elisp file and generates appropriate dependency information, as comments or as elisp require and autoload statements.
‘elisp-depend-directory-list’, like below:
(setq elisp-depend-directory-list '("YourEmacsDirectory"))
By default, this package will use function
‘symbol-file’ to get depend file with current symbol. And then use
‘featurep’ to test this file whether write
‘provide’ sentences for feature reference. If
‘featurep’ return t, generate depend information as “(require ‘foo)” format. If
‘featurep’ return nil, generate depends as “(autoload ‘foo “file”)” format.
This packages will always return depend information as
‘autoload’ format if a feature not write
‘provide’ information in source code.
The newest version of ElispDepend uses
‘read’ to get a sexp containing all the elisp code in the buffer. It then explores the sexp, treating functors such as
‘defun’ specially. Each such special symbol has its own explorer function.
Finally it considers each symbol it found, determining where it’s from and whether to include it.
As of 8 may, 2010, the maintainer is Tom Breton (Tehom), at Andy Stewart’s suggestion.
Very nice. You might also want to relate it to Lisp:lib-requires.el. IIUC, this is generally complementary, but there is also some overlap. One important difference seems to be the method of determining dependencies:
elisp-depend.el does not rely on
‘load-history’; instead, it parses the buffer code. – DrewAdams
‘load-history’to get depend information, and i found sometimes those information is not correct when i modified source code.
‘load-history’– that is how
‘symbol-file’is defined. The difference is that
‘autoloaded’definitions too (not just loaded libraries) as dependencies. – DrewAdams
Consider mentioning in the doc string of
‘elisp-depend-insert-require’ how to use it: If you want a
‘require’, make sure the library is loaded; otherwise you get an
‘autoload’. And perhaps mention
‘elisp-depend-directory-list’ there also. That variable is nice, because code can bind it to affect the behavior of
‘elisp-depend-insert-comment’. – DrewAdams
The latest version is available, Lisp:elisp-depend.el. It uses
‘read’ to understand the buffer so it should be less error-prone than before.