5

Is it possible to make blank lines at the end of tree part of that tree? So I can heave two headings like this:

* Heading1
* Heading2

without space between them, but when Heading1 is expanded there is a blank line at the end that does not propagate upwards. Like this:

* Heading1

  * Subheading1
  * Subheading2

* Heading2

It find it visually pleasing to have a blank line between Subheading2 and Heading2 but when Heading1 is collapsed I do not want to have a blank line between Heading1 and Heading2 ( I use org-indent-mode).

Currently I can have only the version without blank line at the end and without blank line between Heading1 and Heading2:

* Heading1

  * Subheading1
  * Subheading2
* Heading2

or version with blank line at the end of expanded Heading1 BUT that blank line propagates upwards and it appears between Heading1 and Heading2:

* Heading1

* Heading2
  • What you are saying should not be happening with the default value of org-cycle-separator-lines = 2. Have you set that to 1 in your config? – Kaushal Modi Apr 22 '16 at 22:26
  • No, I have it set to 2. – fillemon Apr 22 '16 at 22:27
  • Isn't this what you get in an emacs -Q session? I am running org built from the latest commit on its master branch. – Kaushal Modi Apr 22 '16 at 22:31
  • Well, on that video it can be clearly seen in 0:51 that if you press TAB on heading for the first time, you get subheadings WITHOUT blank line at the end which is what I am trying to solve because very often I dont want to expand all the way down but only to see subheadings. – fillemon Apr 22 '16 at 22:44
  • Sorry, there was some confusion at my end as I had initially copied your example and so I had white space preceeding the sub headings * Subheading1 ... It's now clear that you need to see that white space in the CONTENTS view. – Kaushal Modi Apr 22 '16 at 22:58
1

It does not look like there is an easy/built-in way to customize this behavior.

The function org-cycle-show-empty-lines in org.el appears to be responsible for displaying whitespace between headings. (org-cycle-show-empty-lines is the only place in org.el where org-cycle-separator-lines is used).

This function appears to operate as follows:

  • use org-cycle-separator-lines to build a regex
  • use the regex to find any places that should cause 1 or more lines of whitespace to be displayed between headings
  • display whitespace in the desired places

In other words, the function is pretty much hardcoded to act as described here.

I found a few posts which modify similar folding behavior

I'm afraid that I don't know enough elisp to provide an appropriate function definition yet. But I found a few other posts which have definitions for similar behavior -- that could at least contribute a starting point for a solution.

  • Hide tags in outline view. The solution appears to be a function which you'd run in org-cycle-hook. The docstring for org-cycle-show-empty-lines mentions that hook

    Show empty lines above all visible headlines. The region to be covered depends on STATE when called through `org-cycle-hook'.

    so it may be possible to get the desired behavior in org-cycle-show-empty-lines by mucking with STATE in org-cycle-hook.

  • Completely hide the PROPERTIES drawer. The solution appears to be a complete rewrite of org-cycle-hide-drawers, a pre-existing function in org.el. In your case, this approach would involve a rewrite of org-cycle-separator-lines.

Org mode version info: Org-mode version 8.2.10 (release_8.2.10 @ /usr/local/Cellar/emacs-mac/emacs-25.2-z-mac-6.6/share/emacs/25.2/lisp/org/)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.