Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

org-mode folding considers whitespace as content

Disclaimer: I am new to org-mode.

In org-mode, I sometimes add extra empty lines to make the separation between different tasks clearer when they are expanded. Like so:

** Task 1

*** Subtask 1.1
    text text
*** Subtask 1.2

** Task 2

The problem is that when I fold 'Task 1' (by pressing C-tab while on its line) the subtasks and their contents are folded correctly, but the content of 'Subtask 1.2' is also folded (namely, the new line under it).

If I press C-tab while on the line of 'Subtask 1.2', the message 'SUBTREE (NO CHILDREN)' is printed and 'Subtask 1.2' is correctly not folded.

Is this normal? Can I somehow correct this behaviour so that empty content is not folded?

like image 416
Tohiko Avatar asked Oct 30 '16 18:10

Tohiko


People also ask

What are Org mode files?

Org Mode (also: org-mode; /ˈɔːrɡ moʊd/) is a document editing, formatting, and organizing mode, designed for notes, planning, and authoring within the free software text editor Emacs.

How do I use Org mode in Emacs?

To save the document, either press the save icon, or press C-x C-s, call it 1.org. Emacs does not actually understand you are editing an Org document, yet. To enable Org mode on your current document, type M-x org-mode which will enable the Org mode on the current document. Those are minuses, not underscores.

Does vim have Org mode?

vim is a minimal Org mode and Outline mode plugin for Vim providing only syntax highlighting and folding. This plugin aims to replicate Vim's existing Markdown editing experience on Org mode (and Outline mode) files, rather than trying to be a full featured Org mode plugin—that is what Emacs is for.

How do I export Org mode?

To export your org file to a web page, type C-c C-e to start the exporter and then press h to select html and o to select open. A new web page should now open in your browser. Similarly, typing l and o in the exporter will convert the org file to latex and then compile it to produce a pdf and display that.


1 Answers

Use (setq org-cycle-separator-lines -1) in your config file. This will fix it.

Documentation:
Number of empty lines needed to keep an empty line between collapsed trees.
If you leave an empty line between the end of a subtree and the following
headline, this empty line is hidden when the subtree is folded.
Org mode will leave (exactly) one empty line visible if the number of
empty lines is equal or larger to the number given in this variable.
So the default 2 means at least 2 empty lines after the end of a subtree
are needed to produce free space between a collapsed subtree and the
following headline.

If the number is negative, and the number of empty lines is at least -N,
all empty lines are shown.
like image 110
jue Avatar answered Sep 28 '22 02:09

jue