Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search bug in *cscope* buffer with multiple cscope databases #9

Closed
angrycandy opened this issue Aug 24, 2015 · 2 comments
Closed

search bug in *cscope* buffer with multiple cscope databases #9

angrycandy opened this issue Aug 24, 2015 · 2 comments

Comments

@angrycandy
Copy link

With this code

[bwong@curiosity ~]$ ls adir bdir
adir:
a.c  cscope.files  cscope.out

bdir:
b.c  cscope.files  cscope.out
[bwong@curiosity ~]$ tail adir/*.c bdir/*.c
==> adir/a.c <==
void a(void) {
    b();
    c();
}

==> bdir/b.c <==
void b(void) {
    a();
    c();
}
[bwong@curiosity ~]$ 

and this cscope-database-regexps

(setq cscope-database-regexps
  '(
    ( "^/home/bwong/adir"
      (t)
      ( "/home/bwong/bdir" ))))

After finding functions calling c, *cscope* looks like:

===============================================================================
Finding functions calling: c
Database directory: /home/bwong/adir/

*** a.c:
a[3]                           c();

Database directory: /home/bwong/bdir/

*** b.c:
b[3]                           c();

Search complete.  Search time = 0.01 seconds.

With the cursor on a search for a:

===============================================================================
Finding functions calling: c
Database directory: /home/bwong/adir/

*** a.c:
a[3]                           c();

Database directory: /home/bwong/bdir/

*** b.c:
b[3]                           c();

Search complete.  Search time = 0.01 seconds.
===============================================================================
Finding global definition: a
Database directory: /home/bwong/bdir/

 --- No matches were found ---

Search complete.  Search time = 0.00 seconds.

The above used:

[bwong@curiosity xcscope-el]$ git log -1
commit d845a033058ccb83e32dd9648885e8f608bb6258
Author: Dima Kogan <dima@secretsauce.net>
Date:   Sat May 10 14:37:18 2014 -0700

    removed an unneeded instance of shell-quote-argument
[bwong@curiosity xcscope-el]$ 

This works with:

;
; File:         xcscope.el
; RCS:          $RCSfile: xcscope.el,v $ $Revision: 1.14 $ $Date: 2002/04/10 16:59:00 $ $Author: darrylo $
; Description:  cscope interface for (X)Emacs
; Author:       Darryl Okahata
; Created:      Wed Apr 19 17:03:38 2000
; Modified:     Thu Apr  4 17:22:22 2002 (Darryl Okahata) darrylo@soco.agilent.com
; Language:     Emacs-Lisp
; Package:      N/A
; Status:       Experimental
;
; (C) Copyright 2000, 2001, 2002, Darryl Okahata <darrylo@sonic.net>,
;     all rights reserved.
; GNU Emacs enhancements (C) Copyright 2001,
;         Triet H. Lai <thlai@mail.usyd.edu.au>
; Fuzzy matching and navigation code (C) Copyright 2001,
;         Steven Elliott <selliott4@austin.rr.com>
Finding functions calling: c

Database directory: /home/bwong/adir/
-------------------------------------------------------------------------------
*** a.c:
a[3]                           c();
-------------------------------------------------------------------------------

Database directory: /home/bwong/bdir/
-------------------------------------------------------------------------------
*** b.c:
b[3]                           c();
-------------------------------------------------------------------------------

Search complete.  Search time = 0.01 seconds.

With the cursor on a search for a:

Finding global definition: a

Database directory: /home/bwong/adir/
-------------------------------------------------------------------------------
*** a.c:
a[1]                           void a(void ) {
-------------------------------------------------------------------------------

Search complete.  Search time = 0.01 seconds.
@dkogan
Copy link
Owner

dkogan commented Feb 2, 2016

Hi. Thank you for the report, and I apologize for taking so long. I fixed this in

https://github.com/dkogan/xcscope.el/commit/efa27e22798671356f6cb7a647afb40be326b7ac

The fixed code reads the current directory from the point location in the cscope buffer. I don't use the cscope-database-regexps, so I don't yet have a sense if this is a good default. In your example, searching for "a" in the "a.c" cscope result would do what you want, looking at all the directories in cscope-database-regexps. But searching for something in the "b.c" cscope result would use the database in bdir/ and thus would not touch cscope-database-regexps. Would it make more sense to remember that that whole search came from the regexps entry in dira/ and for subsequent searches to all do that too?

@dkogan dkogan closed this as completed Feb 2, 2016
@angrycandy
Copy link
Author

I verified that https://github.com/dkogan/xcscope.el/commit/efa27e22798671356f6cb7a647afb40be326b7ac works for the example. I think the current behavior is good enough.

Thanks for fixing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants