emacscedetemacs-semantic

Emacs source code navigation features


I am working on a large c++ project. I am working with emacs for the last six months. I have try to configure CEDET so as to be able to navigate easily but i have found some problems.

1.- Sometimes semantic does not find some symbols and sometimes he don't ... i do not know clearly which files is semantic indexing. I have tried to use EDE (following the instructions in this paper http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html), but i have found some problems also...

2.- I was working with vim+cscope some time ago and i remember there was a way to navigate back in the stack of symbols (Ctrl-t). Is there anything like this in emacs?

P.D.> Some data to make the question more clear.

I have multiple releases of the same project. Each one has its own root directory. Each project has multiple modules each one inside a subdirectory. There are headers file in each module.

/home/user/
          |
           \Release-001
          |           |
          |            \makefile
          |            \ Module-001
          |           |           |
          |           |            \makefile
          |           |            \subdir-001
          |           |           |          \header-001.h
          |           |           |          \header-002.h
          |           |            \subdir-002
          |           |           |          \header-003.h
          |            \ Module-002
          |           |           |
          |           |            \makefile
          |           |            \subdir-003
          |           |           |          \header-004.h
          |           |           |          \header-005.h
          |           |            \subdir-004
          |           |           |          \header-006.h
          |
           \Release-002
          |           |
          |            \makefile
          |            \ Module-001
          |           |           |
          |           |            \makefile
          |           |            \subdir-001
          |           |           |          \header-001.h
          |           |           |          \header-002.h
          |           |            \subdir-002
          |           |           |          \header-003.h
          |            \ Module-002
          |           |           |
          |           |            \makefile
          |           |            \subdir-003
          |           |           |          \header-004.h
          |           |           |          \header-005.h
          |           |            \subdir-004
          |           |           |          \header-006.h

This is the configuration about EDE i have in my .emacs

;; Cedet load commands
(add-to-list 'load-path "~/emacs-dir/cedet/cedet")
(load-file "~/emacs-dir/cedet/cedet/common/cedet.el") 

;; EDE: activating mode.
(global-ede-mode t)

;; Projects definition
(ede-cpp-root-project "Release-001"
                     :name "Release-001"
                     :file "~/Release-001/makefile"
                     :include-path '("/"
                                     )
                     :system-include-path '("~/exp/include")
                     :spp-table '(("SUSE9" . "")
                                )
)
(ede-cpp-root-project "Release-002"
                     :name "Release-002"
                     :file "~/Release-002/makefile"
                     :include-path '("/"
                                     )
                     :system-include-path '("~/exp/include")
                     :spp-table '(("SUSE9" . "")
                                )
)

Just to let you know ... I am working with the console version ( -nw) of emacs.


Solution

  • Your configuration is basically correct, except for the :include-path for your projects.

    If a given source file says:

       #include "Module-001/subdir-002/header-003.h"
    

    then it is ok. If the include says:

       #include "subdir-002/header-003.h"
    

    then your :include-path should have

       :include-path '("/Module-001" )
    

    in it.

    As for which things does semantic index, it will index your current file, and all includes it can find. Use the semantic-decoration mode to see which headers EDE has found for you to determine if your configuration is accurate.

    It will also index all files in the same directory as the one you are editing, but only in idle time, so if you don't let Emacs be idle, it won't get around to it.

    You can speed the indexing operations up if you use CScope as Bozhidar suggests. You can then enable the CScope support in both EDE and the Semantic database. The inclusion of CScope support in Semantic DB is recent, however, so you would need the CVS version of CEDET. That would make sure the whole thing was indexed.

    To navigate backward, investigate the help for semantic-mru-bookmark-mode. This tracks your progress through your files on a named location basis that is quite handy and always works.