CEDET help

From OpenCog

Jump to: navigation, search

I advice you to use the last CVS (it works better than the release)

cvs -z3 -d:pserver:anonymous@cedet.cvs.sourceforge.net:/cvsroot/cedet co -P cedet

Follow the instruction to compile CEDET, then you can configure your .emacs to use it (no need to install it).

Here is my config file my-cedet-conf.el that I load from .emacs

;; CEDET configuration
(load-file "/home/nilg/Sources/cedet/common/cedet.el")
(global-ede-mode 1)      ; Enable the Project management system
;; uncomment out one of the following 3 lines for more or less semantic features
;; (semantic-load-enable-minimum-features)
;; (semantic-load-enable-excessive-code-helpers) 
;;enable folding mode to collapse a definition into a single line
;; SRecode minor mode.
(global-srecode-minor-mode 1)
(require 'semantic-ia)
(require 'semantic-gcc)
;; gnu global support
(require 'semanticdb-global)
(semanticdb-enable-gnu-global-databases 'c-mode)
(semanticdb-enable-gnu-global-databases 'c++-mode)
;; ctags
;;(require 'semanticdb-ectag)
;; customisation of modes
(defun my-cedet-hook ()
 (local-set-key [(control return)] 'semantic-ia-complete-symbol-menu)
 (local-set-key "\C-c?" 'semantic-ia-complete-symbol)
 (local-set-key "\C-c>" 'semantic-complete-analyze-inline)
 (local-set-key "\C-c=" 'semantic-decoration-include-visit)
 (local-set-key "\C-cj" 'semantic-ia-fast-jump)
 (local-set-key "\C-cb" 'semantic-mrub-switch-tags)
 (local-set-key "\C-cq" 'semantic-ia-show-doc)
 (local-set-key "\C-cs" 'semantic-ia-show-summary)
 (local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle)
 (local-set-key "\C-cr" 'semantic-symref)
 ;; for senator
 (local-set-key "\C-c\-" 'senator-fold-tag)
 (local-set-key "\C-c\+" 'senator-unfold-tag)
;;(add-hook 'semantic-init-hooks 'my-cedet-hook)
(add-hook 'c-mode-common-hook 'my-cedet-hook)
(add-hook 'lisp-mode-hook 'my-cedet-hook)
(add-hook 'emacs-lisp-mode-hook 'my-cedet-hook)
;; (add-hook 'erlang-mode-hook 'my-cedet-hook)
(defun my-c-mode-cedet-hook ()
;; (local-set-key "." 'semantic-complete-self-insert)
;; (local-set-key ">" 'semantic-complete-self-insert)
 (local-set-key "\C-ct" 'eassist-switch-h-cpp)
 (local-set-key "\C-xt" 'eassist-switch-h-cpp)
 ;;(local-set-key "\C-ce" 'eassist-list-methods)
(add-hook 'c-mode-common-hook 'my-c-mode-cedet-hook)
;;configuring CEDET for OpenCog
(ede-cpp-root-project "OpenCog"
                :name "OpenCog Project"
               :file "~/OpenCog/opencog/CMakeLists.txt"
               :include-path '("/")
               :system-include-path '("/usr/include/"
               ;;:spp-table '(("isUnix" . "")
               ;;("BOOST_TEST_DYN_LINK" . ""))

And the command to load that file, to add in .emacs

;;Load my configuration file of CEDET
(load-file "/home/nilg/OpenCog/my-cedet-conf.el")

You can also copy the following template file under ~/.srecode/ to take advantage of SRecode see http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html#sec15 for a short tutorial, I've started to tweak templates for OpenCog and I'll probably add more in the future.

;; srecode template
;; copy this file under your ~/.srecode/ so that CEDET loads it automatically
set mode "c++-mode"
set COPYRIGHT "This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License v3 as
published by the Free Software Foundation and including the exceptions
at http://opencog.org/wiki/Licenses
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
context file
template header_guard :file :blank
#ifndef _OPENCOG_{{FILENAME_SYMBOL:upcase}}
#define _OPENCOG_{{FILENAME_SYMBOL:upcase}}
#endif // _OPENCOG_{{FILENAME_SYMBOL:upcase}}