I want to access the first entry of a :LOGBOOK:
drawer independently of the visibility of a subtree: folded, partially folded, or unfolded. This function worked on 9.1.9 in the first two cases (folded and partially folded):
(defun my-org-clock-goto-next-clock ()
(interactive)
(org-back-to-heading)
(search-forward "LOGBOOK:")
(org-cycle 3)
(forward-line)
(move-beginning-of-line nil)
)
I upgraded to Org mode 9.3.3 and (org-cycle 3)
no longer unfolds a subtree. At a top-level heading, I see a message:
Already at the top level of the outline
I read the manual on local and global visibility cycling and could not find how to set a subtree to unfolded.
What is the command to unfold all contents of a subtree regardless of the initial state?
(outline-show-subtree)
instead of(org-cycle 3)
.org-cycle
says:When there is a numeric prefix, go up to a heading with level ARG, do a ‘show-subtree’ and return to the previous cursor position. If ARG is negative, go up that many levels.
That probably explains the error, but I don't know why it worked for 9.1.9 - probably an accident.(org-cycle)
when point is on the drawer name (i.e. after the(search-forward ...)
or the(outline-show-subtree)
since the latter returns point to where it was before the call).org-flag-drawer
can be used instead: try(org-flag-drawer nil)
.org-cycle
delegates to it in the case of a drawer. I'll try to get a decent answer written but it won't be before the weekend.