emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: hugo@heagren.com
Cc: "Thomas S. Dye" <tsd@tsdye.online>, emacs-orgmode@gnu.org
Subject: Re: [PATCH 1] lisp/org-fold.el: Fold header lines in blocks (was: Proposal: folding stacked `#+header:' lines in src blocks)
Date: Tue, 13 Dec 2022 09:19:05 +0000	[thread overview]
Message-ID: <87edt3ek52.fsf@localhost> (raw)
In-Reply-To: <32864528822dfa0bc8efe3bcf112cbea@heagren.com>

hugo@heagren.com writes:

> 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.)

This logic does not really belong to org-fold.el. Rather to
org-cycle.el(org-cycle). Ideally, we need to split `org-cycle' into
smaller functions.

Also, changing default toggle behaviour may break third-party usage.
People now expect flipping between folded/unfolded. Your patch will
change that.

> - renames `org-fold--hide-wrapper-toggle' to
>    `org-fold--hide-wrapper-cycle', which seemed more appropriate under
>    the circumstances.

Please, no. As I said above, we need to move the cycling logic to
org-cycle. `org-fold--hide-wrapper-toggle' may only be modified to
accept a new value of FORCE other than 'off.

> 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.

We may define default folding state at startup via defcustom.

> - 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?

Yes. For example, 2.8 Blocks section of the manual. But let's decide
about implementation first. Manual if the last thing to do.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


      reply	other threads:[~2022-12-13  9:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87edt3ek52.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=hugo@heagren.com \
    --cc=tsd@tsdye.online \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).