unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Make cscope/global searching more precise (with the infomation where you started the search)
@ 2010-11-09  1:38 Haojun Bao
  0 siblings, 0 replies; only message in thread
From: Haojun Bao @ 2010-11-09  1:38 UTC (permalink / raw)
  To: emacs-devel

When searching a function/struct definition, if there is only one
definition, then everything is fine. But considering a big codebase
like kernel/android, there could be many. 

For e.g., when reading android's system/core/init, I want to check the
definition of `parse_state` with cscope, and the result is like the
following, I need to use my eyeball to find that the last one is the one
I'm actually looking for (and then move the cursor over it to do the jump):


    *** /home/bhj/src/cupcake/external/e2fsprogs/e2fsck/profile.c:
    parse_state[152]               struct parse_state {
    
    *** /home/bhj/src/cupcake/external/freetype/include/freetype/internal/psaux.h:
    parse_state[574]               T1_ParseState parse_state;
    
    *** /home/bhj/src/cupcake/external/iptables/extensions/libip6t_state.c:
    parse_state[32]                parse_state(const char *state, size_t strlen, struct ipt_state_info *sinfo)
    
    *** /home/bhj/src/cupcake/external/iptables/extensions/libipt_conntrack.c:
    parse_state[60]                parse_state(const char *state, size_t strlen, struct ipt_conntrack_info *sinfo)
    
    *** /home/bhj/src/cupcake/external/iptables/extensions/libipt_state.c:
    parse_state[32]                parse_state(const char *state, size_t strlen, struct ipt_state_info *sinfo)
    
    *** /home/bhj/src/cupcake/system/core/init/parser.c:
    parse_state[69]                struct parse_state
    
This can be improved by calculating starting/resulting file name's
distance. Since here I started the cscope search in a file in
system/core/init, the last entry above is the closest one, and thus
should come as the first!

And it can be easily done using perl's String::Approx module. As an e.g.,
see http://github.com/baohaojun/windows-config/raw/master/bin/linux/gtags-cscope-bhj

With this small trick, in most cases, the first one is the one I'm
looking for, no further ado. And the worst case? let's just forget that
we are calculating distance and use eyeballs again:-)



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-11-09  1:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-09  1:38 Make cscope/global searching more precise (with the infomation where you started the search) Haojun Bao

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).