2013/3/4 David Engster <deng@randomsample.de>
»Ζ³ΙΑΦ writes:
> Hi, I am a newcomer of emacs. I install cedet with el-get, I have updated to
> latest version.

This is actually the problem with all those new package systems for
Emacs: I have no idea what version el-get installs and how it sets it
up.

So please post your init file (.emacs) and show how you load CEDET. I
would also recommend to remove the version that el-get did install and
just either use the latest Emacs pretest (24.2.93 at the moment), which
comes with a pretty current CEDET version, or get CEDET from bzr as
described here:

http://cedet.sourceforge.net/bzr-repo.shtml

-David

Hi David, thanks for your reply. I have update emacs to 24.2.93.1, and checkout cedet from bzr above.
It can loads now, but there is another issue that LIuis have mentioned here. http://sourceforge.net/mailarchive/message.php?msg_id=30499526

This is the backtrace:

Debugger entered--Lisp error: (error "Attempt to load an unsafe project (bug elsewhere in EDE)")
  signal(error ("Attempt to load an unsafe project (bug elsewhere in EDE)"))
  error("Attempt to load an unsafe project (bug elsewhere in EDE)")
  #[(this dir) "....."[this dir o eieio-oref :safe-p ede-directory-safe-p error "Attempt to load an unsafe project (bug elsewhere in EDE)" load-type "Project type error: :load-type failed to create a project" ede-add-project-to-global-list] 4 "Load in the project associated with THIS project autoload description.\nTHIS project description should be valid for DIR, where the project will\nbe loaded."]([object ede-project-autoload "edeproject-makefile" "Make" ede/proj "Project.ede" "" unbound nil ede-proj-load ede-proj-project nil t nil] "/home/xinsuiyuer/")
  apply(#[(this dir)"....."
ede-auto-load-project([object ede-project-autoload "edeproject-makefile" "Make" ede/proj "Project.ede" "" unbound nil ede-proj-load ede-proj-project nil t nil] "/home/xinsuiyuer/")
  ede-load-project-file("/home/xinsuiyuer/emacs_test")
  ede("/home/xinsuiyuer/emacs_test")
  call-interactively(ede nil nil)

And there is a issue about semantic-tag-folding:
I add (global-semantic-tag-folding-mode 1) in my init file(.emacs),  but it doesn't work after opening c source file.
and then M-x semantic-tag-folding-mode , it works fine. If I and (semantic-tag-folding-mode 1) within c-mode-hook in init file(.emacs), I get an error:

Loading /home/xinsuiyuer/cedet/cedet-devel-load.el (source)...
Loading /home/xinsuiyuer/cedet/cedet-remove-builtin.el (source)...done
Loading autoloads from CEDET development.
Loading /home/xinsuiyuer/cedet/cedet-devel-load.el (source)...done
Loading /home/xinsuiyuer/cedet/contrib/cedet-contrib-load.el (source)...
Installing CEDET contrib packages in /home/xinsuiyuer/cedet/contrib/
Loading /home/xinsuiyuer/cedet/contrib/cedet-contrib-load.el (source)...done
`flet' is an obsolete macro (as of 24.3); use either `cl-flet' or `cl-letf'. [2 times]
`labels' is an obsolete macro (as of 24.3); use `cl-labels' instead. [2 times]
(lambda (suffix) ...) quoted with ' rather than with #'
(lambda (arg) ...) quoted with ' rather than with #'
(lambda (ext) ...) quoted with ' rather than with #'
(lambda (suffix) ...) quoted with ' rather than with #'
For information about GNU Emacs and the GNU system, type C-h C-a.
Loading cc-langs...done
File mode specification error: (error "Buffer test.c cannot be folded by semantic")
Loading semantic/db-file...done
File mode specification error: (error "Buffer cdefs.h cannot be folded by semantic")
File mode specification error: (error "Buffer c++config.h cannot be folded by semantic")

Here is the backtrace:

Debugger entered--Lisp error: (error "Buffer test.c cannot be folded by semantic")
  signal(error ("Buffer test.c cannot be folded by semantic"))
  error("Buffer %s cannot be folded by semantic" "test.c")
  semantic-tag-folding-mode-setup()
  semantic-tag-folding-mode(1)
  c-cpp-mode-config()
  (lambda nil (c-cpp-mode-config))()
  run-hooks(change-major-mode-after-body-hook prog-mode-hook c-mode-common-hook c-mode-hook c-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook c-mode-common-hook c-mode-hook c-mode-hook))
  run-mode-hooks(c-mode-hook)
  c-mode()
  set-auto-mode-0(c-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer test.c> "~/test.c" nil nil "~/test.c" (399931 2065))
  find-file-noselect("~/test.c" nil nil t)
  find-file("~/test.c" t)
  call-interactively(find-file nil nil)


My .emacs file:
(load-file "~/cedet/cedet-devel-load.el")
(load-file "~/cedet/contrib/cedet-contrib-load.el")


;; Custom Settings
;; ===============
;; To avoid any trouble with the customization system of GNU emacs
;; we set the default file ~/.gnu-emacs-custom
(setq custom-file "~/.gnu-emacs-custom")
(load "~/.gnu-emacs-custom" t t)

(add-to-list 'load-path "~/.emacs.d/")
(add-to-list 'load-path "~/ecb/")
(add-to-list 'load-path "~/cedet/contrib/")


;;;
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")

(unless (require 'el-get nil 'noerror)
  (with-current-buffer
      (url-retrieve-synchronously
       "https://raw.github.com/dimitri/el-get/master/el-get-install.el")
    (goto-char (point-max))
    (eval-print-last-sexp)))

(el-get 'sync)


(add-to-list 'semantic-default-submodes 'global-semantic-mru-bookmark-mode)
(add-to-list 'semantic-default-submodes 'global-semanticdb-minor-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-scheduler-mode)
(add-to-list 'semantic-default-submodes 'global-cedet-m3-minor-mode t)
(add-to-list 'semantic-default-submodes 'global-semantic-highlight-func-mode t)
(add-to-list 'semantic-default-submodes 'global-semantic-decoration-mode t)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-local-symbol-highlight-mode)
(add-to-list 'semantic-default-submodes 'global-semanticdb-minor-mode)

;; Enable Semantic
(semantic-mode 1)

;; Enable EDE (Project Management) features
(global-ede-mode 1)
(ede-enable-generic-projects)

;; (require 'cogre)
(require 'cedet-contrib)
(require 'cedet-contrib-load)
(require 'semantic-tag-folding)
(require 'eassist)
(require 'semantic/bovine/gcc)

(enable-visual-studio-bookmarks)

(global-semantic-tag-folding-mode 1)

(semanticdb-enable-gnu-global-databases 'c-mode t)
(semanticdb-enable-gnu-global-databases 'c++-mode t)

(when (cedet-ectag-version-check t)
  (semantic-load-enable-primary-ectags-support))




(defadvice push-mark
  (around semantic-mru-bookmark activate)
  "Push a mark at LOCATION with NOMSG and ACTIVATE passed to `push-mark’. If `semantic-mru-bookmark-mode’ is active, also push a tag onto the mru bookmark stack."
    (semantic-mrub-push semantic-mru-bookmark-ring (point) 'mark)
    ad-do-it)



(require 'sourcepair) ; switch between header file and source file
(setq sourcepair-source-path '( "." "../*" "../src" ))
(setq sourcepair-header-path '( "." "include" "../include" "../*" "../inc"))

(defun my-semantic-hook ()
  (imenu-add-to-menubar "Tags"))
(add-hook 'semantic-init-hooks 'my-semantic-hook)

;;; configure solarized-theme
(load-theme 'solarized-dark t)

(setq-default show-trailing-whitespace t)

(global-linum-mode t)
(add-hook 'before-save-hook 'delete-trailing-whitespace)

;;(mouse-avoidance-mode 'animate)

(setq make-backup-files nil)

(defun up-slightly () (interactive) (scroll-up 2))
(defun down-slightly () (interactive) (scroll-down 2))
(global-set-key [mouse-4] 'down-slightly)
(global-set-key [mouse-5] 'up-slightly)


;;; configure doxmacs
(add-hook 'c-mode-common-hook (lambda ()
(doxymacs-mode)))

(defun my-doxymacs-font-lock-hook ()
    (if (or (eq major-mode 'c-mode) (eq major-mode 'c++-mode))
        (doxymacs-font-lock)))
(add-hook 'font-lock-mode-hook 'my-doxymacs-font-lock-hook)


;;;(add-to-list 'load-path "~/.emacs.d/auto-complete-sarcasm")
(add-to-list 'load-path (expand-file-name "~/.emacs.d/irony-mode/elisp/"))


;; (require 'irony)
(require 'auto-complete-config)
(ac-config-default)
;; (setq irony-libclang-additional-flags
;;        '("-isystem" "/usr/lib64/clang/3.2/include/"))

;; (irony-enable 'ac)
;; (add-hook 'c++-mode-hook 'irony-mode)
;; (add-hook 'c-mode-hook 'irony-mode)



;;; configure muse
(require 'my-muse-config)
(require 'google-c-style)
(require 'doxymacs-config)


(defun semantic-ia-fast-jump-back ()
    (interactive)
    (if (ring-empty-p (oref semantic-mru-bookmark-ring ring))
        (error "Semantic Bookmark ring is currently empty"))
    (let* ((ring (oref semantic-mru-bookmark-ring ring))
           (alist (semantic-mrub-ring-to-assoc-list ring))
           (first (cdr (car alist))))
      (if (semantic-equivalent-tag-p (oref first tag) (semantic-current-tag))
          (setq first (cdr (car (cdr alist)))))
      (semantic-mrub-switch-tags first)))


(defun comment-or-uncomment-region-or-line ()
    "Comments or uncomments the region or the current line if there's no active region."
    (interactive)
    (let (beg end)
        (if (region-active-p)
            (setq beg (region-beginning) end (region-end))
            (setq beg (line-beginning-position) end (line-end-position)))
        (comment-or-uncomment-region beg end)
(next-line)))



(defun c-cpp-mode-config ()
  (rainbow-delimiters-mode)
  (google-set-c-style) ;;; define in google-c-style.el
  (hl-line-mode t)
  (local-set-key "\r" 'my-javadoc-return)
  (setq ac-auto-start nil)
  (local-set-key "\C-j" 'auto-complete)

  (yas-minor-mode-on)
  ;;; configure cc-mode
  (c-toggle-auto-hungry-state 1)

  ;; (semantic-mru-bookmark-mode 1) ; enable mru-bookmark
  ;; (semantic-highlight-func-mode 1) ; highlight current function
  ;; (semantic-decoration-mode 1) ; decorate tags
  (semantic-tag-folding-mode 1) ; enable tags folding
  (local-set-key [f12] 'semantic-ia-fast-jump)
  (local-set-key [C-down-mouse-1] 'semantic-ia-fast-mouse-jump)
  (local-set-key [S-f12] 'semantic-ia-fast-jump-back)
  )


(add-hook 'c-mode-hook
  (lambda ()
    (c-cpp-mode-config)
   ))

(add-hook 'c++-mode-hook
  (lambda ()
    (c-cpp-mode-config)
   ))
(add-hook 'emacs-lisp-mode-hook
  (lambda ()
   (rainbow-delimiters-mode)
   (local-set-key "\C-c;" 'comment-or-uncomment-region-or-line)
   (local-set-key "\r" 'newline-and-indent)))

(add-hook 'lisp-mode-hook
  (lambda ()
   (rainbow-delimiters-mode)))

(add-hook 'lisp-interaction-mode-hook
  (lambda ()
   (rainbow-delimiters-mode)))