c++ code folding with emacs/cedet
Asked Answered
N

2

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?

Nonagon answered 19/4, 2012 at 7:41 Comment(0)
N
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)

Noiseless answered 19/4, 2012 at 11:10 Comment(0)
M
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 
Maynard answered 19/4, 2012 at 11:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.