7

I would like to use the semantic code folding from the cedet package (emacs). I installed the 1.1 version and added the following lines to .emacs:

(load-file "~/software/cedet-1.1/common/cedet.el")

(require 'semantic-tag-folding)
(defun c-folding-hook ()
  (global-semantic-tag-folding-mode 1)
  (local-set-key (kbd "C-c <left>") 'semantic-tag-folding-fold-block)
  (local-set-key (kbd "C-c <right>") 'semantic-tag-folding-show-block)
)
(add-hook 'c-mode-common-hook 'c-folding-hook)

Okay, when I now load a c oder c++ file, nothing happens when using the key bindings or directly running the corresponding commands. What's going wrong? Have I forgotten something?

4

2 回答 2

5

First, you don't need to have (global-semantic-tag-folding-mode 1) inside defun - it's better to run this command once...

But I think, that main problem is that you hadn't enabled any Semantic feature (see this section in my article) - at least you need to call (semantic-load-enable-minimum-features) after loading of CEDET.

P.S. you code is working for me (I use semantic-load-enable-excessive-code-helpers in my setup)

于 2012-04-19T11:10:16.067 回答
0

try adding following line in your emacs config file after (load-file "~/software/cedet-1.1/common/cedet.el") line;

(semantic-load-enable-code-helpers) ; Enable prototype help and smart completion 
于 2012-04-19T11:05:54.937 回答