Luke Gorrie luke@bluetail.com writes:
This is a post about M-. from Alan Ruttenberg which bounced for boring mailing list reasons. His idea sounds great to me.
Note that M-. and finding the source location for a given PC in the debugger are implemented in almost the same way in this scenario. You associate with each PC the bounds of the definition form relative to the stored text for the function. Then, within the fuzzy match/alignment of the containing function you fuzzy match/align the source for the form being evaluated at the PC.
What's holding me back from trying this is having access to a fuzzy match algorithm. Does anyone know of one? Or have an idea of how to use some diff variant to get the same effect? Inside emacs would be
How fuzzy?
ideal but we could also run a shell script on the buffer to get the match.
Saving all text and doing lots of computation to navigate to source may seem extravagant to some but it seems to me that the big bucks are in saving our time.
It doesn't sound at all extravagant to me. Emacs understands Lisp source well enough to do paren matching, s-exp navigation, etc. It also does regexp matching. Worst case scenario is you can find all the defxxx forms for foo not inside a #| |# pair. Closest would be some combination of positional and text match. Emacs can search its buffers pretty quickly, so I don't think this would be a problem in terms of the time it takes to position the point in the source buffer. If the errant source file is not in an Emacs buffer, it shouldn't be too hard to deduce the file name and then load it. You can probably gen tags files on the fly also.
Also doing this all in Emacs leaves you with only two flavors to deal with, GNU and XEmacs. Maybe not even that many.
Elisp is terra-incognito for me, so I can't get specific. I just hope I'm not being too off the wall here.