Re: who_calls rewrite
Bill Clementson <[email protected]> Mon, 17 Sep 2007 22:08:59 -0700
| Newsgroups | gmane.comp.lang.erlang.distel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Matthias, Matthias Radestock <[email protected]> writes: > Bill Clementson wrote: >> I had a bit of free time today, so I implemented this (patch >> attached). The who-calls buffer will now let you press RET on a line >> and it will open the source member of the module containing the >> caller and jump to the line number of the function definition of the >> caller (which is what is returned by your "(Lin)(domain (E || ~p))" >> who-calls xref query. > > Great. > >> I think it would be preferable to jump to the place in the function >> where the call was made; however, I don't know what the correct xref >> string should be. It looks like changing the "(Lin)" to something >> like "(LLin + XLin)" is what is needed (so that xref returns the line >> numbers for both local and external calls). However, I played around >> with some variations and couldn't figure out the right one. And, the >> xref documentation didn't provide any enlightenment. Do you know what >> the xref query should be changed to? > > Try something like > {ok, Calls} = xref_q(...,"(XXL)(Lin)(E || ~p)", [MFA]), > lists:flatten([[{Caller, Line} || Line <- Lines] > || {{{Caller,_},_}, Lines} <- Calls]). > > Lines is a list since there can be several call sites per function. In > the above I am just flatting that info, but depending on how you want > to represent this in the UI you may want to do something different. Yep, that did it - thanks! Incidentally, I probably mucked around trying to figure out the xref query string to use for longer than it took me to write the elisp code. Is there any better documentation or examples of xref other than the tools xref document? e.g. - better than: http://www.erlang.org/doc/man/xref.html I've committed the changes. - Bill ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/