Re: who_calls rewrite
Matthias Radestock <[email protected]> Tue, 18 Sep 2007 05:02:43 +0100
| Newsgroups | gmane.comp.lang.erlang.distel.devel |
|---|---|
| Message-ID | <[email protected]> |
Bill,
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.
Matthias.
-------------------------------------------------------------------------
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/