Re: [PATCH 3/3] completion: offer ctags symbol names for 'git log -S', '-G' and '-L:'
- From
Jeff King <peff@peff.net>
- Date
- Apr 1, 2017, 08:50 UTC
- Message-ID
- <20170401085058.y7u73x6beqgnhrcb@sigill.intra.peff.net>
- In-Reply-To
- <20170330100656.18766-1-szeder.dev@gmail.com>
On Thu, Mar 30, 2017 at 12:06:56PM +0200, SZEDER Gábor wrote:
Show 6 quoted lines
> > 1. You still have to come up with the filename yourself for "-L". > > I was already quite satisfied that both the symbol name and the > filename can be TAB completed... but right, in most cases the > function name uniquely determines the filename, and even when it > doesn't, it still significantly limits the possibilities. Hmhm.
I find that I often forget which file a function is defined in, especially in Git's code base (where it sometimes feels somewhat random :) ).
Show 7 quoted lines
> OTOH, the proof-of-concept patch at the bottom shows how we could > start doing filename completion based on the ctags file, and I think > it's really convenient to use. Alas, it doesn't work when the > funcname is not on its own, e.g. ends with that disambiguating '\(:' > from above, and then Bash falls back to its own filename completion. > However, if I may extrapolate from my ~/.bash_history, this would > still help the great majority of the cases.
Yeah, I think that would go a long way to solving my problem.
Show 11 quoted lines
> > I have a script (below) which makes this easier (and I complete its > > argument using the tags file). It's probably too gross to even go into > > contrib, but I thought I'd share. > > Perhaps 'git log -L' could be enhanced to just DWIM when it gets only > '-L:func:', and show the log of that function, wherever it is defined. > So instead of complaining about the missing filename, it could run > 'grep <func>' with a bit of magic to find the filename where the > matching function is declared, and search in the history of that file. > > But then again, 'git log -L' could be enhanced in so many ways...
Yes, that sounds even nicer.
-Peff