10

GitHub - legalnonsense/org-visual-outline

 3 years ago
source link: https://github.com/legalnonsense/org-visual-outline
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.org

./screenshot.gif

  1. Put it in your load path.
  2. (require 'org-visual-outline)
  3. (org-visual-outline-mode)

This is a first working hack at providing a visual outline tree. The code is a mess and needs a major re-write, preferably by someone who knows more than me about how things work.

It relies on a combination of org-indent (via advising org-indent-add-properties) and font-lock. I don’t defend any programming choice I made here, and would not put it out there unless I thought there was hope someone else might take it from me.

The display is updated via various hooks (found in org-visual-outline-refresh-hooks) and advising certain other functions (found in org-visual-outline-refresh-funcs).

The icons are meaningful. means the heading has children and is folded. means the heading is unfolded. means the heading does not have any children. If the icon is filled (i.e., or ), it means the heading has text in its body. If the icon is not filled (i.e., or ▽), it means there is no body text.

(This also means that org-ellipsis is not needed, because you know if a subtree is folded, and whether there is text in the body. So, you can hide the ellipsis by setting its foreground face to your background color.)

I do not know what performance costs this has. So far, I have been able to use it without issue aside from some slowdown when unfolding headings with a lot of text. This can be mitigated by using a more responsible re-drawing function.

Previous attempts provided clearer outline tree (e.g., using joints like └ and ├ to more clearly show the outline structure). The problem was there was no way to connect the vertical lines between one line the next, because there (appears) to be no way to fill that space without setting the background color of the point. It looked more like:

├─▽ I.
│ ├▭ I.a.
│ └▭ I.b.
└▭ II.

I thought this was too noisy, so abandoned it. The vertical lines are connected now because they use a face that sets the background color and sets a height of .1.

Any thoughts welcome. Or please fork it and fix it up.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK