问题
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.
回答1:
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)
回答2:
I use hideshow.el - it seems to work better for me.
来源:https://stackoverflow.com/questions/878766/emacs-collapsing-functions-in-class-using-outline-minor-mode