Tor Kringeland <[email protected]> writes:
>> A more efficient way could be introducing a new customization similar to
>> org-cycle-hide-block-startup. Say, it can be
>> org-cycle-hide-drawer-startup. See the attached patch.
>
> I can always hide the
> drawers by adding `org-cycle-hide-drawers' to `org-cycle-hook' when I
> call my custom function, but I cannot replicate the behavior of
> `org-cycle' without `org-cycle-hide-drawers' in the hook, which would
> uncoditionally open all the drawers (AFAIK).)
Sure. Now, you need to call a different function to open all the drawers
unconditionally. That function is:
(let* ((headline (save-excursion (org-back-to-heading) (org-element-at-point)))
(section (org-element-lineage
(org-element-at-point
(org-element-property :contents-begin headline))
'(section))))
(when section
(org-fold-region
(org-element-property :begin section)
(org-element-property :end section)
nil 'drawer)))
Though we might also modify org-fold-show-entry to allow what you wish.
I am not sure here.
Best,
Ihor