emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [PATCH] Re: Change in `org-cycle-hook' breaks behavior


From: Ihor Radchenko
Subject: Re: [PATCH] Re: Change in `org-cycle-hook' breaks behavior
Date: Sat, 28 May 2022 11:31:42 +0800

Tor Kringeland <tor.kringeland@ntnu.no> 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



reply via email to

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