So round three and some copy and paste.
Upon request and with some tips from masse I rebuilt the lookup functionality to make more use of Erlang.
This solution skips the elisp bruteforce in favor of extracting debug information about include files used when a module was built. It then looks through the include files using epp_dodger to look for definitions of macros and records. A link to the file is then returned to the elisp code and we jump to the definition.
Rewrote a bunch of the elisp to better follow the original style of distel elisp.
Fixed the code for searching through epp_dodger parse trees to find more macro definitions. Don't know if there are more variants, but I'll probably leave it at this.
Former comments about this not working with recursive includes was wrong, since we look through the beam code for include files all necessary files have already been found by the preprocessor or compiler(?).
Function to extract a list of header files used when module was built.
Functions to find in what file a macro or record is defined.
Refactored original erl-find-source* functions to support lookup of
macros and record definitions in addition to functions.
Make thing_in_file/3 catch more definitions in the parse trees
Filter out empty lists.
Filter out the file we call from correctly.
M-. on function definitions should call erl-who-calls.
M-. and M-, to jump to calling functions from and back to erl-who-cal…