emacs collapsing functions in class using outline-minor-mode

拜拜、爱过 提交于 2019-12-12 11:33:45

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!