我希望每次打开.cpp文件时,语义标记折叠都会被激活我正在使用最新版本的cedet(loading 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))

在此之后,在my.emacs中不会发生与cedet/语义相关的任何事情事实上,我可以让这成为我的.emacs的唯一内容。
它不起作用打开.cpp文件时,我得到消息文件模式说明错误:(错误“Buffer foo.cpp cannot be fold by semantic”)。
奇怪的是,如果,一旦文件打开,我做M-x语义标签折叠模式,它工作我只是迷路了。

最佳答案

我得到了完全相同的错误,使用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.

对我有用。

10-08 01:12