GNU Emacs 24.3 で el-get を使用して公式の CEDET 2.0 をインストールし、構成しました。コードのジャンプと補完にはうまく機能しますが、Emacs 組み込みの which-function-mode では適切に機能しません。メジャー モードが Java モードの場合、有効な関数が認識されないかのように、Emacs モードの行に [???] が表示されるだけです。しかし、CEDET 構成を削除すると、 which-function-mode はうまく機能します。したがって、問題は公式の CEDET 2.0 に関連していると思います。which-function-mode を手動で有効にしようとしましたが、問題は解決しません。
構成のどこで問題が発生するのかわかりません。
誰でも助けることができますか?ありがとう。
更新: 行 (semantic-mode 1) をコメントアウトしてセマンティックを無効にすると、 which-function-mode が機能します。CEDET ドキュメントを確認したところ、セマンティックは私が行った方法で有効になっています。
(add-to-list 'load-path (concat cedet-root-path "contrib"))
(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)
(add-to-list 'semantic-default-submodes 'global-semantic-highlight-func-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-local-symbol-highlight-mode)
;; Activate semantic
(semantic-mode 1)
;; Load contrib library
(require 'eassist)
(when (not (member system-type '(gnu gnu/linux darwin cygwin)))
(if (executable-find "gcc")
(semantic-gcc-setup)
(message "GCC is not installed and semantic analysis will be restriced.")))
(setq pulse-flag 'never) ; No fade in/out effect
(setq semanticdb-default-save-directory
(expand-file-name "~/.emacs.d/semanticdb"))
(setq eassist-header-switches
'(("h" . ("cpp" "cxx" "c++" "CC" "cc" "C" "c" "mm" "m"))
("hh" . ("cc" "CC" "cpp" "cxx" "c++" "C"))
("hpp" . ("cpp" "cxx" "c++" "cc" "CC" "C"))
("hxx" . ("cxx" "cpp" "c++" "cc" "CC" "C"))
("h++" . ("c++" "cpp" "cxx" "cc" "CC" "C"))
("H" . ("C" "CC" "cc" "cpp" "cxx" "c++" "mm" "m"))
("HH" . ("CC" "cc" "C" "cpp" "cxx" "c++"))
("cpp" . ("hpp" "hxx" "h++" "HH" "hh" "H" "h"))
("cxx" . ("hxx" "hpp" "h++" "HH" "hh" "H" "h"))
("c++" . ("h++" "hpp" "hxx" "HH" "hh" "H" "h"))
("CC" . ("HH" "hh" "hpp" "hxx" "h++" "H" "h"))
("cc" . ("hh" "HH" "hpp" "hxx" "h++" "H" "h"))
("C" . ("hpp" "hxx" "h++" "HH" "hh" "H" "h"))
("c" . ("h"))
("m" . ("h"))
("mm" . ("h"))))
;; Save the current jump point in order to jump back when using CEDET
;; http://comments.gmane.org/gmane.emacs.cedet/5127
(defvar semantic-tags-location-ring (make-ring 512))
(defun semantic-goto-definition (point)
"Goto definition using semantic-ia-fast-jump
save the pointer marker if tag is found"
(interactive "d")
(condition-case err
(progn
(ring-insert semantic-tags-location-ring (point-marker))
(semantic-ia-fast-jump point))
(error
;;if not found remove the tag saved in the ring
(set-marker (ring-remove semantic-tags-location-ring 0) nil nil)
(signal (car err) (cdr err)))))
(defun semantic-pop-tag-mark ()
"popup the tag save by semantic-goto-definition"
(interactive)
(if (ring-empty-p semantic-tags-location-ring)
(message "%s" "No more tags available")
(let* ((marker (ring-remove semantic-tags-location-ring 0))
(buff (marker-buffer marker))
(pos (marker-position marker)))
(if (not buff)
(message "Buffer has been deleted")
(switch-to-buffer buff)
(goto-char pos))
(set-marker marker nil nil))))
(defun cedet-common-setup ()
(local-set-key (kbd "C-c j") 'semantic-goto-definition)
(local-set-key (kbd "C-c b") 'semantic-pop-tag-mark)
(local-set-key (kbd "C-c o") 'semantic-ia-show-summary)
(local-set-key (kbd "C-c d") 'semantic-ia-show-doc)
(local-set-key (kbd "C-c p") 'semantic-analyze-proto-impl-toggle)
(local-set-key (kbd "C-c f") 'semantic-symref)
(local-set-key (kbd "C-c r") 'semantic-symref-symbol)
(local-set-key (kbd "C-c <left>") 'semantic-tag-folding-fold-block)
(local-set-key (kbd "C-c <right>") 'semantic-tag-folding-show-block)
;; We use auto complete to get candidate
(if window-system
(local-set-key (kbd "M-n") 'semantic-ia-complete-symbol-menu))
(local-set-key (kbd "C-c m") 'eassist-list-methods))
(defun cedet-c-c++-setup ()
;; (local-set-key "." 'semantic-complete-self-insert)
;; (local-set-key ">" 'semantic-complete-self-insert)
(local-set-key (kbd "C-c h") 'eassist-switch-h-cpp) ; Jump between .c and .h
(when (executable-find "cscope")
(require 'cedet-cscope)
(require 'semantic/db-cscope)
(semanticdb-enable-cscope-databases)
(local-set-key (kbd "C-c i") 'cedet-cscope-create/update-database)))
(defun cedet-java-setup ()
(require 'cedet-java)
(require 'semantic/db-javap))