我希望每次打开.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文件时,我收到消息文件模式规范错误:(错误"Buffer foo.cpp cannot be folded by semantic")。
奇怪的是,一旦文件打开,我执行M-x语义标签折叠模式,它就能工作!我只是迷路了。
发布于 2013-05-12 20:14:54
我得到了完全相同的错误,使用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.这对我很有效。
https://stackoverflow.com/questions/15307113
复制相似问题