Semantic

I’ve been running an Emacs built from bzr for a while now.  I did this so I could try a newer version of Semantic; the one in Emacs 23 is just too broken to use.

Semantic, in case you haven’t heard of it, is an ambitious project to turn Emacs into an IDE.  Really it is quite a crazy project in some ways — it includes its own implementation of CLOS (which opens a strange Emacs maintenance debate: how can CLOS be ok but the CL package not be?) and a port of Bison to elisp (but again, strange: the port is really a pure port, it does not use sexps as the input — bizarre).

Semantic is now usable in Emacs — I’ve found a few buglets, but nothing serious.  In fact, now I find it indispensible.

I have it configured in the most Emacsy way of all: I didn’t make any changes, I just enabled it with M-x semantic-mode.  Then I visited a bunch of gdb source files.  Semantic started indexing them in the background.

Now when I want to jump to a declaration or definition of a function, I use C-c , J.  The key binding is nuts, of course, but I’ve been too lazy to rebind it yet.  Anyway, this acts basically like M-., except you don’t have to ever run etags.  Wonderful.

Semantic has some other nice features, too, but I haven’t really used them yet.  If you’re using it I’d love to hear what you do with it.

 

4 Comments

  • It’s better to take CEDET/Semantic from its bzr, not from Emacs’s bzr – there are many fixes there, etc. But I hope, that fresh Semantic will merged into Emacs soon

  • How easy is it to run the out-of-tree Semantic? I’ve been messing around trying to get JDEE working in Gentoo but failing because of the merge of CEDET into emacs 23 which I assumed meant you didn’t need the external packages. Is Semantic/CEDET bzr the way to go? When will the fixes be merged back into the mainline?

  • Yeah, I wonder that too. When I tried before, the out-of-tree one was much harder to set up; but that was a while ago.

  • Yeah, I’m using CEDET bzr and it seemed to fix a few problems. It wasn’t too difficult to set up, but it’s a bit different than the version in emacs (they are merging back some changes that were made on the emacs side).

    NOTE: instead of C-c , J, you might want to use semantic-ia-fast-jump. It doesn’t make you type the tag, rather it analyses the context at point and figures out where you need to jump to automatically.

    Also, you probably want to setup both ede and the gcc integration so that semantic will automatically pick up headers and source files rather than making you visit them.

    I recommend asking questions on the semantic mailing list… They have a lot of documentation, but sometimes it’s hard to figure out the right way to do things with semantic just by looking at the docs.

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>