哪个功能模式不能与官方的CEDET 2.0一起使用 [英] which-function-mode cannot work with official CEDET 2.0

查看:76
本文介绍了哪个功能模式不能与官方的CEDET 2.0一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在GNU Emacs 24.3上使用el-get安装了官方的CEDET 2.0,并对其进行了配置.尽管它非常适合代码跳转和完成,但不能与Emacs内置的which-function-mode一起正常使用.当主要模式是Java模式时,Emacs模式行仅显示[???],就像没有识别到​​有效功能一样.但是,当我删除我的CEDET配置时,哪种功能模式效果很好.因此,我认为问题应该与官方的CEDET 2.0有关.我试图手动启用哪个功能模式,问题仍然存在.

I have installed official CEDET 2.0 using el-get on GNU Emacs 24.3 and configured it. Although it works great for code jump and completion, it cannot work properly with Emacs built-in which-function-mode. When the major modes is Java mode, the Emacs mode line simply displays [???], like no valid function is recognized. But when I removed my CEDET configuration, which-function-mode works well. So I think the problem should be related to the official CEDET 2.0. I tried to manually enable which-function-mode, the problem is still persist.

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

I cannot figure out where it goes wrong with my configuration.

任何人都可以帮忙吗?谢谢.

Can anyone help? Thanks.

更新:如果我通过注释掉行来禁用语义(语义模式1),那么哪个功能模式将起作用.我检查了CEDET文档,并按照我的方式启用了语义.

Update: If I disabled semantic by commenting out the line (semantic-mode 1), which-function-mode would work. I checked the CEDET documents, the semantic is enabled in the way as I did.

(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))

推荐答案

次要模式 global-semantic-idle-breadcrumbs-mode 大致类似于 which-func-mode ,但使用标题而不是模式行,因此它有更多空间来描述您的上下文.还有"global-semantic-stickyfunc-mode"也很相似,但是只显示了部分功能不在屏幕顶部,而不显示光标在什么地方.

The minor mode global-semantic-idle-breadcrumbs-mode is roughly similar to which-func-mode but uses the header instead of the mode line so it has more room to describe your context. There is also `global-semantic-stickyfunc-mode' which is also similar, but only shows what functions is partly off the top of the screen, not what the cursor is in.

要在不禁用语义的情况下启用原始的 which-func-mode ,您可能需要仅禁用用于集成的通知语义.将 ad-disable-advice 用于 semantic-哪可以将其关闭.CEDET的最新版本不会尝试重载which-func,因此更新到最新版本也可以.

To enable the original which-func-mode without disabling semantic, you may need to just disable the advice semantic uses for integration. Use ad-disable-advice for semantic-which to turn it off. The latest version of CEDET doesn't try to overload which-func so updating to the latest could work too.

这篇关于哪个功能模式不能与官方的CEDET 2.0一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆