哪个功能模式不能与官方CEDET 2.0一起使用

时间:2013-06-15 01:36:52

标签: emacs cedet

我在GNU Emacs 24.3上使用el-get安装了官方CEDET 2.0并对其进行了配置。尽管它对于代码跳转和完成非常有用,但它无法与Emacs内置的功能模式一起正常工作。当主要模式是Java模式时,Emacs模式行只显示[???],就像没有识别有效功能一样。但是当我删除了我的CEDET配置时,哪个功能模式运行良好。所以我认为问题应该与官方的CEDET 2.0有关。我试图手动启用哪个功能模式,问题仍然存在。

我无法弄清楚我的配置出了什么问题。

有人可以帮忙吗?感谢。

更新 如果我通过注释掉行(语义模式1)来禁用语义,那么函数模式将起作用。我检查了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))

1 个答案:

答案 0 :(得分:0)

次要模式global-semantic-idle-breadcrumbs-modewhich-func-mode大致相似,但使用标题而不是模式行,因此它有更多空间来描述您的上下文。还有“global-semantic-stickyfunc-mode”也类似,但只显示哪些功能部分偏离屏幕顶部,而不是光标所在。

要启用原始which-func-mode而不禁用语义,您可能需要禁用语义用于集成的建议。使用ad-disable-advice semantic-which将其关闭。最新版本的CEDET不会尝试重载哪个函数,因此更新到最新版本也可以正常工作。