GithubHelp home page GithubHelp logo

xcscope.el's People

Contributors

asn-d6 avatar bertogg avatar dkogan avatar dme avatar jaalto avatar ptrv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xcscope.el's Issues

navigating function call hierarchy

while tracing a function call flow, we can go up the call-stack via the "cscope-pop-mark", once that is done, the popped mark is lost.

it would be nice if we could have a 'queue' kind of semantics where the call chain can be traversed backwards and forwards as well.

How to change the behavior of quitting cscope display buffer

When press q, the cscope display buffer is closed and replaced with a second source code buffer. Therefore, there are two buffers for the source code and I have to manually kill one of them.

I hope, when press q, the cscope display buffer can be completely closed and return the focus to source code buffer. I think this can be customized by modifying cscope-display-buffer-args, do you have any idea about how to change and achieve this feature?

Tramp support

Hi,

I've been using xcscope for awhile locally. I recently started to use Tramp and was interested in using xcscope over Tramp, but don't really know how to set it up. Wondering if you can point me to some instructions on how to get it working.

Thanks!

Completion for input tag

Thank you for the package.
Switched to this one from ggtags because of much better performance and more search options.
It seems xcscope lacks tag completion feature.
Any plans to implement it?

xcscope don't work with sub-directories

I've read the docs, but still can't make xcscope.el work with sources in sub-directories.

files in the directory:

cscope.out
[...]
got/
lib/

I start emacs got/got.c, then point cursor to the function, which is defined in file inside lib/ directory, and press C-s c d, and I get:

Finding global definition: got_worktree_open
Database directory: /home/misha/work/got/

cscope: no source files found


Search complete.  Search time = 0.02 seconds.

If I patch xcscope.el with the following:

--- xcscope.el.orig     Sun Mar 13 22:34:38 2022
+++ xcscope.el  Sun Mar 13 22:34:47 2022
@@ -2500,7 +2500,7 @@
     (save-excursion
       (catch 'finished
        (set-buffer outbuf)
-       (setq options '("-L"))
+       (setq options '("-LR"))
        (while (and (not done) cscope-search-list)
          (setq next-item (car cscope-search-list)
                cscope-search-list (cdr cscope-search-list)

everything starts working, and I get window with function name, and can jump to file inside lib/ directory.

I can't imagine that I'm first person, who has source files in different sub-directories. Am I missing something obvious?

OS: OpenBSD current
Cscope: cscope-15.9p0

"display-buffer" fallbacks to "display-buffer-fallback-action"

Parentheses are missed here:
(defvar cscope-display-buffer-args (and (not cscope-running-in-xemacs) (>= emacs-major-version 24) '(display-buffer-use-some-window (inhibit-same-window . t)))

Should be:
(defvar cscope-display-buffer-args (and (not cscope-running-in-xemacs) (>= emacs-major-version 24) '((display-buffer-use-some-window (inhibit-same-window . t))))

MacOS: xcscope.el can't be run within emacs 22.1.1

I just downloaded xcscope.el and add the below 2 lines to my .emacs on my own MacOS.

(load-file "~/xcscope/xcscope.el")
(require 'xcscope)

My emacs version is 22.1.1.

However when I run # emacs --debug-init, I met the below error.

Debugger entered--Lisp error: (error "Unknown keyword :risky")
signal(error ("Unknown keyword :risky"))
error("Unknown keyword %s" :risky)
custom-handle-keyword(cscope-keymap-prefix :risky t custom-variable)
custom-declare-variable(cscope-keymap-prefix "^Cs" "Prefix for key bindings of cscope-minor-mode'.\n\nChanging this variable outside Customize does not have any\neffect. To change the keymap prefix from Lisp, you need to\nexplicitly re-define the prefix key:\n\n (define-key cscope-minor-mode-keymap cscope-keymap-prefix nil)\n (setq cscope-keymap-prefix (kbd \"C-c ,\"))\n (define-key cscope-minor-mode-keymap cscope-keymap-prefix\n cscope-command-map)" :group cscope :type string :risky t :set (lambda (variable key) (when (and ... ...) (define-key cscope-minor-mode-keymap ... nil) (define-key cscope-minor-mode-keymap key cscope-command-map)) (set-default variable key))) (defcustom cscope-keymap-prefix "^Cs" "Prefix for key bindings of cscope-minor-mode'.\n\nChanging this variable outside Customize does not have any\neffect. To change the keymap prefix from Lisp, you need to\nexplicitly re-define the prefix key:\n\n (define-key cscope-minor-mode-keymap cscope-keymap-prefix nil)\n (setq cscope-keymap-prefix (kbd "C-c ,"))\n (define-key cscope-minor-mode-keymap cscope-keymap-prefix\n cscope-command-map)" :group (quote cscope) :type (quote string) :risky t :set (lambda (variable key) (when ... ... ...) (set-default variable key)))
eval-buffer(#<buffer load<2>> nil "/Users/zhuangyan/xcscope/xcscope.el" nil t) ; Reading at buffer position 50383
load-with-code-conversion("/Users/zhuangyan/xcscope/xcscope.el" "/Users/zhuangyan/xcscope/xcscope.el" nil nil)
load("/Users/zhuangyan/xcscope/xcscope.el" nil nil t)
load-file("/xcscope/xcscope.el")
eval-buffer(#<buffer load> nil "/Users/zhuangyan/.emacs" nil t) ; Reading at buffer position 8630
load-with-code-conversion("/Users/zhuangyan/.emacs" "/Users/zhuangyan/.emacs" t t)
load("
/.emacs" t t)
#[nil "^H<85>¾^@ Æ=<83>^Q^@Ç^HÈQ<82>A^@ É=<83>3^@ÊÇËÌ#<83>#^@Í<82>A^@ÊÇËÎ#<83>/^@Ï<82>A^@Í<82>A^@ Ð=<83>=^@Ñ<82>A^@Ç^HÒQ^ZÓ^SÔ\nÓ<89>#<88>^KÓ=<83>i^@ÕÖ×Ç^HØQ!"^\Ô\fÓ<89>#<88>^KÓ=<83>h^@\n^S)^K<83>®^@Ù^K!Ú<9a><83>®^@Û^K!<89>^]ÜP^^$Ý^N$!<83><8a>^@^N$<82><95>^@Ý^M!<83><94>^@^M<82><95>^@Ë<89>^U<83>­^@Þ^M^K"<83>«^@ßà^M^K#<88>áâ!<88>^M^S*^N%?<85>½^@Ë^^&ÔãÓ<89>#))<87>" [init-file-user system-type user-init-file-1 user-init-file otherfile source ms-dos "" "/_emacs" windows-nt directory-files nil "^\.emacs\(\.elc?\)?$" "/.emacs" "^_emacs\(\.elc?\)?$" "~/_emacs" vax-vms "sys$login:.emacs" "/.emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default" alt inhibit-default-init inhibit-startup-message] 7]()
command-line()
normal-top-level()

multiple "cscope: cannot find file ..." in *cscope* buffer

Hi, when I tried to use xcscope to find definition or something, it prints multiple lines of

cscope: cannot find file path/to/file

and I notice that the path/to/file is symbolic link file, I know this issue was posted #8 and it is the issue of cscope itself, but could you please remove those lines from the cscope buffer, that would be better, since I use cscope command from terminal, there is no such "cannot find" line from the result of cscope.

Add multiple databases to search list.

I have multiple cscope databases to refer to at once. Is there any way in which I can add all the database to the search list? Basically, I want to add multiple directories to cscope-set-initial-directory, but once I add a new directory, only that directory remains, and the previous ones are discarded. Same functionality can be achieved in vim by the command :cscope add <path to database>

Please excuse if this is a rookie question as I'm not very familiar with lisp.

"<file> is not readable or exists" when using xcscope over TRAMP

When using xcscope over TRAMP, the database can be found and the query results shown correctly. However, the results cannot be jumped to with a message "<file> is not readable or exists". It seems that xcscope tries the filename on my local machine.

More specifically,

  • I was at a file /scp:val17:/home/yf/src/qemu-git/migration/ram.c.
  • I used cscope-find-global-definition to find the definition of memory_global_dirty_log_start
  • The *cscope* buffer showed the global definition correctly
    Finding global definition: memory_global_dirty_log_start
    Database directory: /scp:val17:/home/yf/src/qemu-git/
    
    *** /home/yf/src/qemu-git/memory.c:
    memory_global_dirty_log_start[2568] void memory_global_dirty_log_start(void )
    
    Search complete.  Search time = 0.76 seconds.
  • But I could not jump to the entry. A message shows "/home/yf/src/qemu-git/memory.c is not readable or exists

It seems that xcscope tried the filename (/home/yf/src/qemu-git/memory.c) on my local machine instead on remote.

Getting nonsense results

I work on a large codebase, with my cscope database updated nightly. My xcscope is configured only with '(cscope-option-do-not-update-database t).

When I search for a C symbol in xcscope (C-c s s, or M-x cscope-find-this-symbol), I get something like this:

Finding symbol: ODT_SYSTEM_VERSION_ID
Database directory: /home/jlargentaye/trees/b/nvos/
*** nv/cli/def/exe/ip_show_community_list.h:
<global>[31963]                [no] [<UI32>] (p) deny tcp <IP6ADDR> <IP6MASK> neq <UI32> any neq <UI32>

*** nv/lib/odt/rr/.gitignore:
0),[83250]                     (int64_t)(LLONG_MAX),
,[83317]                       (int )(INT_MIN),
Search complete.  Search time = 0.09 seconds.

(there are actually 7 results for this specific search, whittled down for this example)

If I run cscope from the cli (as cscope -d to avoid refreshing the database!), the results are valid:

C symbol: ODT_SYSTEM_VERSION_ID

  File              Function                            Line
0 version_show.h    <global>                               14 cmo_obj_id = ODT_SYSTEM_VERSION_ID);
1 odt_id_exe.h      <global>                              214 #define ODT_SYSTEM_VERSION_ID 1048776
2 cli_parse.c       <global>                            26416 6 ODT_SYSTEM_VERSION_ID

(again, results shortened for this example)

Both xcscope and cli cscope use the same database.

Any hints on how I could debug this? Elisp unfortunately remains mostly opaque to me, and I couldn't immediately find debugging hooks or prints in xcscope.el.

search bug in *cscope* buffer with multiple cscope databases

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 <[email protected]>
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) [email protected]
; Language:     Emacs-Lisp
; Package:      N/A
; Status:       Experimental
;
; (C) Copyright 2000, 2001, 2002, Darryl Okahata <[email protected]>,
;     all rights reserved.
; GNU Emacs enhancements (C) Copyright 2001,
;         Triet H. Lai <[email protected]>
; Fuzzy matching and navigation code (C) Copyright 2001,
;         Steven Elliott <[email protected]>
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.

"Cscope" does not show in the menu bar of Emacs 26.1 or Emacs 25.3.1

Hi Dima,

I did the two test cases on my own iMac.

Case A

  1. I downloaded Emacs Mac Port which uses Gnu Emacs 26.1
    https://github.com/railwaycat/homebrew-emacsmacport
  • Use xcscope.el provided here

(load-file "~/bin/xcscope.el")
(require 'xcscope)

  1. Then I ran emacs and "Cscope" is not shown in the menu bar.

screen shot 2018-04-19 at 9 51 26 am

So when I click "Control C S S", "s" character is input.

Case B:

  1. Install emacs via brew
    brew install emacs // to get Emacs 25.3.1
  • Use xcscope.el provided here

(load-file "~/bin/xcscope.el")
(require 'xcscope)

  1. Then I ran emacs and I met the same issue as case A, "Cscope" does not show in the menu bar.

Regards,
Andrew

How to change the default bindings of xcscope

There are two default bindings in xcscope.el:

C-c s g -- cscope-find-global-definition
C-c s G -- cscope-find-global-definition-no-prompting

But most of time I just use C-c s G which is cscope-find-global-definition-no-prompting, since G is Shift-g, so how can switch the bindings to

C-c s g -- cscope-find-global-definition-no-prompting
C-c s G -- cscope-find-global-definition

========================

And I notice that a lot of cscope-* functions will prompt, but most of time I just call cscope functions for the current word where my point is, so I come up two solutions:

1. define a variable that I can choose to prompt or not prompt for all `cscope-*` functions
2. give every cscope function a prefix such as `C-u`, with `C-u`, all the functions will prompt, otherwise all of them will not prompt.

I think the 2nd solution is better.

failed to parse filename

Looks like a regression of commit [b9bd846]:(b9bd846)

I use "emacs -nw" with gtags as cscope backend.
My cpp source file has :

...
// kkk" before void WtRaw::Convert()
#define ConvertFpN(...) 0  // kkk
...

When I try to search text "kkk", I got:
image

While if I revert commit b9bd84, I got correct output:
image

GNU Global support requires version 5.9

It seems that GNU Global support doesn't work over TRAMP... gtags-cscope works fine locally, but when I set the active directory to the same project (with a GTAGS file) remotely no results are returned.

I'll try to dig down into this later when I have some time, but I wanted to at least make a note here in the mean time.

Support for inline functions

Hello there,

I found cscope is a great tool to navigate in a large project. Using it since a long time.1 issue I am facing is if a function is defined as inline, then cscope-find-global-definition doesn't show that function. Please add this functionality. Thanks.

xcscope have problem on emacs-w32, on windows, compiled by MinGW.

Hi,

I use this on ubuntu, every thing is awesome, and when I turn to windows, it's not work.
I found the root case is the code slip on xcscope.el
"(shell-quote-argument cscope-program)"
it's make wrong result on windows,
(setq cscope-program "cscope") ; set the cscope
(shell-quote-argument cscope-program) ; generate a ""cscope"", which is not a valid executable file name.
and I replace all "(shell-quote-argument cscope-program)" to "cscope-program", it's worked.

Please check this and improve it.
Thank you.

How to use cscope-database-regexps

am using emacs 24.3 with xcscope. I need help in setting cscope-database-regexps. I am trying to setup so that it will look for code in this order

/home/mike/Src/master1/child1/child1
/home/mike/Src/master2/child2/child2
/home/mike/Src/master1
/home/mike/Src/master2

So in .emacs I did the following, but it does not work. I don't see cscope.out get created in each of the directories I listed above.

I put /home/mike/Src/master1/child1/child1 and /home/mike/Src/master2/child2/child2 since they are my primary area of my work. If a search is not found that, I want to expand to the rest of the tree. Hence I have my priorities. I want to know how can I do that with xcscope.

Thank you.

(setq cscope-database-regexps
'(
( "^/home/mike/Src/master1/child1/child1"
t
)
( "^/home/mike/Src/master1//"
t
)
( "^/home/mike/Src/master2/child2/child2"
t
)
( "^/home/mike/Src/master2/"
t
)
)
)

Refactoring using cscope

As xcscope can be used to find symbol references, it is useful to allow xcscope to refactor:

  • First, it finds all the references of a particular symbol
  • Then, it allows to replace all the symbols with new symbol entered by user.

This can be done either with an open cscope buffer, or directly through an interactive command, i.e. xcsope-refactor.

xcscope.el and user-reserved keybindings collision

According to http://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html
C-c , letter being [A-Za-z] are reserved for users.

The keybinding prefix C-c s collides with this convention.

I suggest that this prefix is changed to something else (and perhaps the C-c s binding is kept
as deprecated alternative in case user has not defined C-c s herself), and information is added
how user can re-map C-c s to this keymap if she so chooses (it is reserved for her, anyway).

does xcscope support symbolic link file ?

I use scope-index to generate the TAGS file cscope configure file.

but it will produce following errors :

cscope: cannot find file lib/inets/test/httpc_SUITE_data/cgi_echo.c

which is a symbolic link to other file :

gi_echo.c -> ../httpd_SUITE_data/cgi_echo.c

the file is exist.

so I am not sure does this error cause by symbolic link file not supported by xcscope ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.