Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [code-folding]

Code folding is a feature of Emacs that allows one to ‘fold’ (collapse/hide) and ‘unfold’ (expand/reveal) large blocks of code.

1
vote
0answers
27 views

Fold all methods in a Python class with Evil

How can I fold all the methods in a Python class? I use Evil and would prefer a pure Evil solution, if possible. I'm looking for a quick way to take something like this: class LongClassIDidNotWrite(...
0
votes
0answers
18 views

`Outline minor mode` folding

When I use outline-hide-body inside Elisp code, I would expect the folding to show me the overview of 3+ ; levels. But it still shows the code, basically all of it with folded bodies. Is there a ...
3
votes
0answers
29 views

deeply nested loops and conditionals

I am refactoring legacy code. Looks like: for (int i = 0; i < something.length; i++) { .... .... lots of code here .... if (a.good != b.bad) { .... .... .... ...
0
votes
0answers
30 views

Org-mode hide note by default within a fold

In Emacs org-mode, if I take a note by C-c C-z for a node then press TAB to cycle the tree's visibility, the note's content will always show up. Instead, I would prefer if the note only shows up as a ...
0
votes
1answer
55 views

Folding headers containing source code blocks in an org file?

I always refer to org mode when I want to document anything, but what I am struggling with right now is how to make folding mechanism work when my headers contain source code blocks under a list ...
4
votes
1answer
48 views

Auctex: Fold all environments of a specific type in a buffer

With auctex I can run TeX-fold-env the environment on which point currently is located. How can I fold all environments foo (\begin{foo}... \end{foo}) in my buffer at once? And how to unfold all ...
3
votes
0answers
38 views

Unfold/expand tree when undoing

When I hit the wrong key in a folded org-mode buffer and I hit undo, the cursor normally jumps to some folded location and it's pretty hard to understand what is going on. Expanding the parents of ...
0
votes
0answers
25 views

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.
0
votes
3answers
130 views

Verilog mode to navigate from begin to end

I am using verilog mode for Emacs. I am trying to find which begin is paired with which end. Is there any way to do this in Emacs?
6
votes
2answers
208 views

JSON file folding and step-by-step unfolding

I need to look at larger, quite deeply nested JSON files in Emacs. Similar to the terminal tool json-view I would like to start with the JSON file completely folded and then open each level step-by-...
1
vote
1answer
120 views

How to fold / collapse the first comment block on file load?

Is there a way to fold the first comment of a file on load? While I don't like code folding in general, it can be handy in this one instance when every file has a boiler plate header which isn't ...
1
vote
0answers
109 views

outline minor mode folding enhancements wanted

This query is two questions both related to latex major mode (not Auctex), outline minor mode, code folding. I eventually solved these questions myself. My "answers are given below the ========== ...
1
vote
0answers
23 views

ESS folding for R6 classes

What is the proper way to install, configure and activate folding of R script files? I followed emacswiki.org/emacs/FoldingMode but it doesn't seems to work. I installed folding.el to .emacs/lisp/. ...
1
vote
0answers
79 views

collapse input cell in ein

I am using ein with emacs 25-3. As some of the cells I am writing contain classes definitions, I would like to be able to collapse them to show only the first line. I know output cells can be toggled ...
0
votes
1answer
72 views

Fold code using headlines inside org-mode elisp source code block

To manage my config I use org-mode. To manage packages inside this I use use-package. Problem is that there are packages that require a lot of configuration like ibuffer and org-mode. Now I'm looking ...
0
votes
1answer
80 views

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) (...
0
votes
0answers
27 views

start folding-mode automatically for folded files

Same as what "folding-mode start fully folded?" is asking, but the answer there is not helping me. The documentation says, But if you always use folding, then perhaps you want more ...
2
votes
1answer
195 views

how do you fold/unfold complex ruby code blocks

I found a snippet that let's me fold bad(large) blocks of code (add-hook 'ruby-mode-hook (lambda () (hs-minor-mode))) (eval-after-load "hideshow" '(add-to-list 'hs-special-modes-alist ...
4
votes
1answer
133 views

Folding code between a literal “begin”/“end” block using Hideshow

A formatted input file (*.alm) often contains a large section of columned data. To fold this and improve navigation, I've tried to implement a hs-special-mode-alist entry from hideshow.el. (setq hs-...
0
votes
0answers
109 views

Change folded heading face after ellipsis

Some of the themes I've tried using change the background color of folded headings after the ellipsis. As you can see in the image: * Folded heading one ... [This area has a different background, ...
1
vote
0answers
54 views

How to disable code folding for coq?

When I do isearch on the buffer having coq mode it somehow executes code folding, something like (... *)... I have tried to use (setq company-coq-disabled-features '(code-folding)) for disabling code ...
2
votes
1answer
116 views

Vim Triple Braces Code Folding in Emacs?

I am migrating from Vim to Emacs because I can't get Org mode to work in Vim. In Emacs is there a way to replicate Vim's marker folding so that # Foo {{{ foo # }}} Turns into +-- 1 lines: # ...
1
vote
1answer
99 views

outline mode: Fold everything when loading file (specifically LaTeX mode)

I am using outline minor mode for LaTeX mode and would like emacs to automatically hide all section environments when opening a .tex file. How could I do that?
1
vote
0answers
136 views

Making relative line numbers behave well with folds?

Context: I have relative line numbers displayed in emacs. If there is a fold (for example: in org-mode), these relative numbers appear to "jump". For example if I'm on line 0 over a fold, emacs could ...
2
votes
1answer
76 views

In Auctex, how could I fold acronyms?

Auctex comes with a folding mode that already folds most of the uninteresting things. However, acronym macros are not folded. How can I instruct Auctex to fold acronym macros (e.g., \ac, \acp, \acf, ...
2
votes
1answer
150 views

Fold entire preamble in AUCTeX

Can AUCTeX be configured to fold the entire LaTeX preamble (i.e., hide everything before \begin{document})? For example, it would be nice if the the following document: \documentclass[letter,11pt]{...
1
vote
1answer
37 views

How to fold the highest headline which I am currently in?

I often do the following sequence in my org-mode file: Go to the root headline from current position Fold the whole subtree Is there a way to this sequence with a shortcut?
4
votes
0answers
80 views

hs-minor-mode: hide only some comment

In ESS mode with hs-minor-mode on, I want to collapse only those comments which directly belong to a function, not other comments which are separated by newlines. Take this example: ############## ##...
1
vote
1answer
353 views

Org-mode hide tags in outline view

Can anyone think of a way to hide org-mode tags, perhaps something along the lines of this solution to completely hide the properties drawer? I would love to hide tags but still have them searchable ...
0
votes
1answer
29 views

My code for streching text lines collapses any org-mode headline in a buffer. How to avoid it?

I have a code for changing a paragraph of auto filled text into a paragraph with one sentence per line, where each sentence stretches out in its full length. This code is perfect when composing and ...
6
votes
1answer
120 views

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 ...
3
votes
0answers
36 views

mangled terminal output after failing emacsclient / folding mode launch

I consistently get the following problem on Emacs 24.5.1 with folding package (version 20140401.3) for which I've found a workaround but would like to understand what was going on. As you can see in ...
3
votes
1answer
496 views

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 " ...
0
votes
0answers
28 views

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 ** ...
2
votes
3answers
175 views

Org-Mode cycling inside subtree impossible?

In org mode I go to a subtree. This subtree contains lots of text, let's say a thousand lines. I want to look up some information in it. I got it, but now I want to collapse that subtree I'm in ...
0
votes
2answers
214 views

loading the `folding` mode with `use-package`

I am using the folding minor mode in Emacs which I get installed with the following use-package macro: (use-package folding :ensure t) The above works and ensures that folding is installed ...
0
votes
2answers
158 views

browsing/navigating reStructuredText

What Emacs utilities can provide better browsing and navigation of reST documents? Alternatively, how to configure existing utilities to work with reST? What I mean, why I ask: Of the lightweight ...
2
votes
0answers
37 views

Using hideshow with Perl code / POD

I've got emacs' HideShow mode working well with Perl code (let's face it, it's a doddle), but I don't know if it's even possible to get it to fold POD comments as well. Has anyone done this (and if so,...
0
votes
0answers
33 views

How can I fold each word in a header?

I'd like to fold each word in a header in org-mode. In other words, I'd like to toggle between this view: * emacs is fun and this view : * e i f and hopefully toggle each word like : * e is f ...
0
votes
1answer
416 views

evil-vimish-fold based on syntax

evil-vimish-fold is really great for custom folds. However it's not clear to me how you would accomplish syntax based folds. Does evil-vimish-fold work with JavaScript mode? Can I set evil-vimish-...
16
votes
2answers
1k views

Outline editing, like org-mode, for JSON

I am trying to edit a Swagger JSON file in emacs. It contains large nested JSON objects, so I want to collapse and hide some of them. I have tried origami-mode, configured as origami-c-style-parser ...
3
votes
1answer
634 views

hs-minor-mode with python.el - hide if statements, for/while loops, etc

Currently, I use the hs-minor-mode to collapse my python code and make it easier to work with - however, by default this only folds def my_function(): blocks. Is it possible to get it to work with if, ...
1
vote
1answer
394 views

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 ...
3
votes
0answers
247 views

Can emacs beautify existing tcl source code?

I'm just getting started with tcl; what sort of beautifier, or prettifier, or formatter, is there for tcl with emacs? My main interest would be to fix existing scripts so that particularly the ...
6
votes
1answer
65 views

What mix of customisations are required to have org files always open exactly as they were closed?

org-customize has a node for startup folded, with options no fold, fold, content, and show everything. There doesn't seem to be an option for "remember last folded state". For such a customisable ...
2
votes
0answers
62 views

Collapse regexp matches within a line

Is there a way I can collapse/expand regexp matches within a line? e.g. let's say I have this list and want to hide some parts of it temporarily: * apple: fruit; red * butter: dairy; yellow when I ...
3
votes
1answer
561 views

Hideshow with python hiding only one part

I've been trying to use Hide Show package in emacs. I encountered a problem when using python. Let's say I have the following code: When I have hit the command hs-hide-level. This is the result. ...
1
vote
1answer
333 views

How to continue giving list number after insert a block of code

GNU Emacs 24.5.1 (i686-pc-mingw32) Org-mode version 8.2.10 (release_8.2.10 @ e:/emacs/share/emacs/24.5/lisp/org/) In my org file, 1. one thing #+begin_src sh ls -la #+end_src 2. second ...
0
votes
0answers
77 views

remap evil-mode normal-state folding key to folding-mode folding-toggle-show-hide

Is there a way to remap the "zc" or "zf" key combo for code folding from evil-mode normal-state to folding-toggle-show-hide? I tried (define-key evil-normal-state-map "zc" 'folding-toggle-show-hide) ...
5
votes
1answer
299 views

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 ...