emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Sorting nodes by clocked time


From: Noah Slater
Subject: Re: [O] Sorting nodes by clocked time
Date: Thu, 17 Apr 2014 14:02:15 +0200

Okay, wow. Thanks for writing that. Do you have a Gittip or something? I would love to support your OSS work in some way or otherwise show my gratitude beyond words in an email!

Anyway. I tried your function and it works. But afterwards, the node is completely folded. So I added (org-cycle) to the sequence of functions inside save-restriction. That seems to work, but I'm no elisp/Org pro. Is this how you would have done it?


On 17 April 2014 13:55, Bastien <address@hidden> wrote:
Noah Slater <address@hidden> writes:

> Okay, that seem to work.
>
> But I'm not able to get this work:
>
> (add-hook 'org-after-sorting-entries-or-items-hook
>           (lambda() (org-cycle-hide-drawers 'children)))
>
> After running the sort, all the LOGBOOK draws are still open.

Try this:

(defun my-hide-all-drawers-in-current-subtree ()
  "Hide all drawers in the current subtree."
  (save-restriction
    (org-narrow-to-subtree)
    (org-cycle-hide-drawers 'all)
    (org-cycle-internal-local)))

(add-hook 'org-after-sorting-entries-or-items-hook
          'my-hide-all-drawers-in-current-subtree)

> I'm also thinking: even if this closes the logbook draws, all the
> nodes will be unfolded. But my node tree is quite large. Is it be
> possible to refold all the nodes after n-levels?
>
> So let's say I have:
>
> * Level 1
> ** Level 2
> *** Level 3
>
> If I move the point to Level 1 and sort, I'd like it fold all Level 2
> items, but leave Level 1 unfolded.

You can fix the cycling through the hook above.

HTH,

--
 Bastien


reply via email to

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