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?

Thomas W.
  • 2,134
  • 2
  • 24
  • 46

2 Answers2

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)

Alex Ott
  • 80,552
  • 8
  • 87
  • 132
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 
legoscia
  • 39,593
  • 22
  • 116
  • 167
sardok
  • 1,086
  • 1
  • 10
  • 19