简体   繁体   中英

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.

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)

我使用hideshow.el - 它似乎对我更好。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM