Re: [Distel-hackers] who_calls rewrite
Status: Beta
Brought to you by:
lukeg
From: Matthias R. <mat...@so...> - 2007-09-18 04:02:50
|
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. |