3 ms·
For something similar in Emacs: (defun toggle-fold () "Toggle current buffer's folding." (interactive) (if selective-display (set-selective-dis
by silentbicycle 18y ago
For something similar in Emacs:
(defun toggle-fold ()
"Toggle current buffer's folding." (interactive)
(if selective-display
(set-selective-display nil)
(set-selective-display language-fold-column)))
where language-fold-column is the column that function bodies (or methods within a class, etc.) are indented to by default. I set the language-fold-column variable in my language-mode hook.
I find this helpful when skimming a module -- it limits it to function descriptions (docstring-like comments preceding the methods, if any) and the function type (in the OCaml sense); the function bodies are replaced with "...". With well-named functions (long sigh), this is often sufficient. Granted, it's based solely on indentation, but it works pretty well for several languages.