Code folding is a feature of Emacs that allows one to ‘fold’ (collapse/hide) and ‘unfold’ (expand/reveal) large blocks of code.
Questions tagged [code-folding]
90 questions
31
votes
3 answers
How can I replicate Vim's code folding?
Code folding in Emacs
Sometimes I want to fold a block of text. In Vim you have easy folding without fuzz. Without to add any special characters like "markers" or specific regex like {{{. I would like to select a region and fold it, without messing…

ReneFroger
- 3,850
- 23
- 66
8
votes
3 answers
Folding mode with YAML?
When working with YAML (using yaml-mode), is there a way to fold a hierarchical tree in a DWIM manner (i.e., without manually adding the {{{ ... }}} markers of folding-mode manually)?
yaml-mode itself seems to have no provisions for that.
The…

AnoE
- 408
- 2
- 12
6
votes
1 answer
How can I hide general text in parentheses?
I have some legal text that is peppered with digressions and interpolations in parentheses, so many that it is hard to keep track of the main text.
Pasting the text into emacs at least allows me to match parentheses easily, but it occurs to me that…

SlowLearner
- 245
- 2
- 6
6
votes
2 answers
Absolute fold level in Emacs?
Is there a way to emulate Vim's folding of .vimrc from Emacs?
In other words, I believe most folding and hiding packages in Emacs rely on open and closing expressions. I am not sure of the internals of these, as I have not tried to learn this much…

Brady Trainor
- 193
- 4
5
votes
1 answer
folding-mode start fully folded?
I tried many different folding plugins for Emacs and ended up using folding-mode as I used Vim's folding marks and so my files contain a large number of folding marks. I am currently in the process of switching from Vim to Emacs…

cataclysmic
- 827
- 1
- 6
- 13
2
votes
1 answer
Folding by levels (like a vim)
How can I implement folding behaviour like a vim?
In vim I has this code:
set foldenable " enable folding
set foldmethod=indent " fold sections by indentation
set foldcolumn=1 " display folding column
set foldlevel=0 "…

sivakov512
- 526
- 3
- 13
1
vote
0 answers
How is folding setup in org-mode?
I'm trying to setup folding for Abaqus/Calculix inp files.
The format is basically as follows: keywords are represented as * and it's contents are what follows. This is quite like org-mode.
So far I've tried origami but the results are not…

Nidish Narayanaa
- 179
- 1
- 7
1
vote
1 answer
Fundamental mode doesn't support HideShow minor mode
I want hs-minor-mode features, I chose it amongst many options I reviewed. How to make it work?
The only package I have atm is web-mode. I put this line in my init file:
(hs-minor-mode)
The error on Emacs startup:
Debugger entered--Lisp error:…

mikl
- 423
- 3
- 20
0
votes
1 answer
Fold second-level (all methods) when opening a py-file (with hs-minor-mode)
I use hs-minor-mode currently.
When point is on class Foo... a M-x hs-hide-level will fold all methods of that class.
This is exactly the state I need for all *.py files when I open them. Is it possible?
When I open a python file all methods of all…

buhtz
- 729
- 5
- 23
0
votes
0 answers
vimish-fold fold overlay highlight colour
Is there a way to change vimish-fold's fold highlight colour? I tried customize-group but didn't see an option to change it.

Arktik
- 972
- 4
- 17
0
votes
1 answer
Please help understanding following elisp code of origami package
In file origami.el of package origami from MELPA is the function origami-fold-node and there is the following piece of code, which I do not understand:
(when (-some? (lambda (pair)
(let ((a (car pair))
(b…

jue
- 4,576
- 8
- 21
0
votes
0 answers
Show additional lines that are not part of the file
What I want is the opposite of code folding. Code folding looks like this:
Unfolded:
1 * Top Level
2 ** Second Level
3 Info that belongs to Second Level
4 More Info that belongs to Second Level
5 ** Another Second Level
6 More Info
Folded (usually…

deadghost
- 827
- 1
- 7
- 13