gpt4 book ai didi

Emacs CEDET 语义标签折叠

转载 作者:太空宇宙 更新时间:2023-11-03 18:40:19 25 4
gpt4 key购买 nike

我希望每次打开 .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)

我添加了一个钩子(Hook)

(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 semantic-tag-folding-mode,它就起作用了!我只是迷路了。

最佳答案

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

对我有用。

关于Emacs CEDET 语义标签折叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15307113/

25 4 0