emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Proposal: folding stacked `#+header:' lines in src blocks
@ 2022-12-07 11:26 hugo
  2022-12-07 19:58 ` Thomas S. Dye
  0 siblings, 1 reply; 4+ messages in thread
From: hugo @ 2022-12-07 11:26 UTC (permalink / raw)
  To: Emacs Orgmode

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-13  9:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-07 11:26 Proposal: folding stacked `#+header:' lines in src blocks hugo
2022-12-07 19:58 ` Thomas S. Dye
2022-12-12 12:10   ` [PATCH 1] lisp/org-fold.el: Fold header lines in blocks (was: Proposal: folding stacked `#+header:' lines in src blocks) hugo
2022-12-13  9:19     ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).