emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Proposal: folding stacked `#+header:' lines in src blocks


From: hugo
Subject: Proposal: folding stacked `#+header:' lines in src blocks
Date: Wed, 07 Dec 2022 11:26:06 +0000
User-agent: Roundcube Webmail/1.5.2

Sometimes I deal with large blocks (generally src blocks) with a lot of
header arguments. To deal with this, I stack them up in `#+header:'
lines. Real example from a file I have:

,----
| #+header: :results (if (org-export-derived-backend-p org-export-current-backend 'latex) "latex" "file raw") | #+header: :file (if (org-export-derived-backend-p org-export-current-backend 'latex) nil "foo.png")
| #+header: :packages '((nil "tikz" t))
| #+header: :imagemagick t :fit t
| #+header: :headers '("\\usetikzlibrary{calc,positioning,patterns}")
| #+begin_src latex
|   <tikz stuff here>
| #+end_src
`----

This is fine, but the height of the header lines often rather gets in
the way when I'm working (once I've written them out, or expanded them
from a snippet, I don't want to see them again).

Thus, I propose that stacked `#+header:' line on top of blocks be
foldable. I'm thinking of this as roughly analagous to folding property
drawers under headlines. That is:
- the header stack should be foldable independently of the block's
  content. That is, I should be able to fold up my stack of five header
  lines into one line, without folding my block.
- the header lines should be folded by default when the block is folded
- there should be a variable (corresponding to
  `org-cycle-hide-drawer-startup') controlling wether the header stacks
  are shown on startup or not.
- /unlike/ property drawer folding, I think it would be good if hitting
  <tab> repeatedly cycled the block through three states:
  - everything unfolded
  - header folded and content open
  - everything folded.

First question: what do people think of this, do people support this as
an idea?

If so, second question: I think this would be implemented by altering
`org-fold--hide-wrapper-toggle' to treat blocks specially with a cyclic
folding system. Is this right?

If other people think this is a good idea, and that's roughly the way to
go, I'll try to make a patch at some point.

Any thoughts welcome!

Hugo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]