Emacs CEDET Semantic标签折叠

4

我希望每次打开 .cpp 文件时,语义标签折叠都能自动激活。我使用的是最新版本的 cedet(加载 cedet-devel-load.el)。

(semantic-mode 1)
(require 'semantic/ia)
(require 'semantic/bovine/gcc)
(load-file "path/to/semantic/tag/folding/semantic-tag-folding.el")
(require 'semantic-tag-folding)

我添加了一个钩子。
(add-hook 'c-mode-common-hook 'setupcpp)

在“setupcpp”中,我只需要

(defun setupcpp ()
(interactive)
(semantic-tag-folding-mode t))

在我的.emacs文件中,与cedet/semantic无关的内容都不会发生。实际上,我可以将此作为我的.emacs文件的唯一内容。

但它并没有起作用。当打开.cpp文件时,我收到错误消息:文件模式规范错误:(错误“缓冲区foo.cpp无法被semantic折叠”)。

奇怪的是,如果在文件打开后执行M-x semantic-tag-folding-mode命令,它就能工作!我很困惑。

1个回答

4
我遇到了完全相同的错误,使用的是Emacs 24.3版本和最新的cedet bzr版本。
我的解决方法如下: 每当有内容被装饰时,折叠模式也会被启用。
(load-library "~/emacs/cedet/cedet-bzr/trunk/cedet-devel-load")
(load-library "contrib/semantic-tag-folding.el")

(defun do-after-decorate () (semantic-tag-folding-mode t) )
(add-hook 'semantic-decoration-mode-hook 'do-after-decorate) 
;; ... 
(semantic-load-enable-excessive-code-helpers) ; also starts the decorate-mode when useful.

对我来说没问题。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接