emacs24 semantic completion
Asked Answered
I

1

4

I'm trying to get semantic completions working with emacs 24 and the version of cedet that comes with it. Completions work for classes I defined in my own source file, but completion isn't working for the standard library or STL stuff Here is my emacs config:

(require 'cedet)
(require 'semantic)
(require 'semantic/ia)
(require 'semantic/bovine/gcc)
(semantic-add-system-include "/usr/include/c++/4.6.3" 'c++-mode)
(setq semantic-default-submodes
      '(global-semantic-idle-scheduler-mode
        global-semanticdb-minor-mode
        global-semantic-idle-summary-mode
        global-semantic-idle-completions-mode
        global-semantic-highlight-func-mode
        global-semantic-decoration-mode
        global-semantic-mru-bookmark-mode))
(setq semanticdb-default-save-directory "~/.semanticdb/"
  semantic-complete-inline-analyzer-idle-displayor-class 'semantic-displayor-ghost)
(semantic-mode t)

In my ~/.semanticdb directory I only see "!usr!include!c++!4.6!x86_64-linux-gnu!bits!semantic.cache", which isn't even using the version I specified in the config.

When I try M-x semantic-analyze-possible-completions on a std::list, for example, I get an error saying: "Cannot find types for std::list"

Any suggestions for how to debug this or how to fix it?

Inness answered 12/1, 2013 at 16:48 Comment(0)
M
1

I was installing today a fresh Ubuntu 13.04 on my new SSD, and here are my steps to configure CEDET ( I checked that it gives completions for std::list).

Basic setup

  1. Get a fresh emacs and build it from source. It's as easy as

    ./configure && make && sudo make install

  2. Add to .emacs (semantic-mode 1)

That's the whole setup.

Testing

  1. Run emacs without loading anything:

    emacs -q test.cc

  2. Enter the code

    #include <list>

    int main() {
        std::list lst;
        lst.$
        return 0;
    }
    
  3. M-x semantic-mode

  4. with point at $, M-x semantic-ia-show-variants

Troubleshooting

If stuff doesn't work, it's likely that the semanticdb is corrupt.

Just find where it is, for me it's semanticdb-default-save-directory="~/.emacs.d/semanticdb", and remove everything from there.

Then, when visiting a source file, call semantic-force-refresh.

Maid answered 21/7, 2013 at 16:31 Comment(2)
Maybe its a system config thing. I'm running on CentOS and I tried your steps above, but I get the same error. After step 4, I get "Cannot find types for 'std::list lst'".Inness
Did you go through the troubleshooting steps? Also, make sure that you've launched the emacs that you built. f1 C-a will show the version. It has to be 24.3.4Maid

© 2022 - 2024 — McMap. All rights reserved.