[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1] lisp/org-fold.el: Fold header lines in blocks (was: Proposal:
From: |
hugo |
Subject: |
[PATCH 1] lisp/org-fold.el: Fold header lines in blocks (was: Proposal: folding stacked `#+header:' lines in src blocks) |
Date: |
Mon, 12 Dec 2022 12:10:31 +0000 |
User-agent: |
Roundcube Webmail/1.5.2 |
On 2022-12-07 19:58, Thomas S. Dye wrote:
I would use this feature. My stack typically includes headers, a
name, and a caption. It would be nice to fold them all out of sight.
Great! I've worked up a patch (well, two patches), attached.
Some details of the implementation:
- folding blocks now cycles:
- everything folded (only top header line visible if present,
otherwise only `#+begin' line visible).
- all content visible, (header stack folded, top header visible,
`#+begin' and `#+end' lines visible).
- everything visible
- (the second and third are treated as equivalent unless there is
more than one header line.)
- Folding will happen on pressing <tab> (or whatever you have bound)
with point:
- anywhere on the `#+begin' or `#+end' line
- on any header keyword (`#+name:', `#+header', etc.)
- anywhere else in the header stack where completion does not
otherwise kick in (not quite sure of the exact mechanics on this
one, might be dependant on one's configuration)? This includes
part-way through header lines.
- This seemed to me the most comfortable configuration for use.
- Retain the old behaviour of moving point to the beginning of the
remaining visible lines when point is hidden by folding.
- renames `org-fold--hide-wrapper-toggle' to
`org-fold--hide-wrapper-cycle', which seemed more appropriate under
the circumstances.
- All the tests in testing/lisp/test-org-fold.el pass for me.
Some less-than-perfections:
- I'm not sure what to do about default block folding (as in, how
blocks are folded when a file is first visited). First, I don't have
a complete list of things (variables, startup options, etc.) which
affect it. Secondly, I'm not sure what the behaviour should be now
that blocks can be in up to three folding states. Advice would be
appreciated.
- I'm not sure what other documentation I should add. Once this patch
is stable and people approve of it, I can add a news entry. Should I
update the manual at all?
Hope this is useful!
Hugo
0002-lisp-org-fold.el-Rename-org-fold-hide-wrapper-toggle.patch
Description: Text Data
0001-lisp-org-fold.el-Fold-header-lines-in-blocks.patch
Description: Text Data