Hamza Yerlikaya
Hamza Yerlikaya

Reputation: 49339

emacs collapsing functions in class using outline-minor-mode

What kind of a hook should i use to collapse just functions in the class. I want to see the outline of the functions in the class but if i hook hide-all everything including the class is collapsed during open.

Upvotes: 4

Views: 1733

Answers (2)

Cheeso
Cheeso

Reputation: 192607

I use hideshow.el - it seems to work better for me.

Upvotes: 1

Trey Jackson
Trey Jackson

Reputation: 74480

This little snippet does the trick for me. However, you probably want to restrict which files have outline mode enabled. You can customize the commented out when statement to do that. And add the proper close paren.

(defun my-outline-trigger ()
  "enable outline mode and hide all the function bodies"
  ;; (when (member major-mode '(cc-mode emacs-lisp-mode)) ....)
  (outline-minor-mode)
  (hide-body))

(add-hook 'find-file-hooks 'my-outline-trigger)

Upvotes: 2

Related Questions