使用大纲小模式的类中的emacs折叠函数 [英] emacs collapsing functions in class using outline-minor-mode

查看:109
本文介绍了使用大纲小模式的类中的emacs折叠函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该使用哪种钩子来折叠类中的函数。我想查看类中函数的轮廓,但是如果我钩住所有东西,包括类在内的所有内容都将在打开过程中折叠。

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)

这篇关于使用大纲小模式的类中的emacs折叠函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆