emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Sorting nodes by clocked time
@ 2014-04-07 16:44 Noah Slater
  2014-04-17  8:33 ` Bastien
  0 siblings, 1 reply; 23+ messages in thread
From: Noah Slater @ 2014-04-07 16:44 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]

Hello,

Is there any way to sort a collection of siblings by the total clocked
time? If not, approximately how hard would this be for me to write?

Ideally, I could specify the scope of the clocked time, just like you can
do in a clocktable. Perhaps "last30" (days) would be my preferred default.

This feature would allow me to keep my node list sorted by how much time
has been spent on each area. Which would be a great feedback mechanism.

Thanks,

Noah

[-- Attachment #2: Type: text/html, Size: 625 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-07 16:44 Sorting nodes by clocked time Noah Slater
@ 2014-04-17  8:33 ` Bastien
  2014-04-17 10:39   ` Noah Slater
  0 siblings, 1 reply; 23+ messages in thread
From: Bastien @ 2014-04-17  8:33 UTC (permalink / raw)
  To: Noah Slater; +Cc: emacs-orgmode

Hi Noah,

Noah Slater <nslater@tumbolia.org> writes:

> Is there any way to sort a collection of siblings by the total
> clocked time?

Now there is in master: C-c ^ k on a headline.

Thanks for this idea,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17  8:33 ` Bastien
@ 2014-04-17 10:39   ` Noah Slater
  2014-04-17 10:41     ` Noah Slater
  2014-04-17 10:55     ` Bastien
  0 siblings, 2 replies; 23+ messages in thread
From: Noah Slater @ 2014-04-17 10:39 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

Oh, funny. I had already patched this locally. I picked "e" for "tim[e]".

Using your version, I get an error:

"sort: Wrong type argument: number-or-marker-p, (10426 . 10437)"

Any clue?

I tried to recompile everything under my .emacs.d (including org-mode), but
I still get the error.


On 17 April 2014 10:33, Bastien <bzg@gnu.org> wrote:

> Hi Noah,
>
> Noah Slater <nslater@tumbolia.org> writes:
>
> > Is there any way to sort a collection of siblings by the total
> > clocked time?
>
> Now there is in master: C-c ^ k on a headline.
>
> Thanks for this idea,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 1180 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 10:39   ` Noah Slater
@ 2014-04-17 10:41     ` Noah Slater
  2014-04-17 11:00       ` Bastien
  2014-04-17 10:55     ` Bastien
  1 sibling, 1 reply; 23+ messages in thread
From: Noah Slater @ 2014-04-17 10:41 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1210 bytes --]

Also, something I was hoping to look at was that when I sort, it expand all
the nodes, including all of the :LOGBOOK: draws.

I find this very inconvenient, and probably will not use this feature
unless I can get it sorted.

It appears that the code is expanding the nodes and the draws to read the
clock times. But I'm wondering if this is possible without expanding
everything, or if it is possible to restore the state after the
calculations are done.

Is this an easy change? Would you be interested in a patch?


On 17 April 2014 12:39, Noah Slater <nslater@tumbolia.org> wrote:

> Oh, funny. I had already patched this locally. I picked "e" for "tim[e]".
>
> Using your version, I get an error:
>
> "sort: Wrong type argument: number-or-marker-p, (10426 . 10437)"
>
> Any clue?
>
> I tried to recompile everything under my .emacs.d (including org-mode),
> but I still get the error.
>
>
> On 17 April 2014 10:33, Bastien <bzg@gnu.org> wrote:
>
>> Hi Noah,
>>
>> Noah Slater <nslater@tumbolia.org> writes:
>>
>> > Is there any way to sort a collection of siblings by the total
>> > clocked time?
>>
>> Now there is in master: C-c ^ k on a headline.
>>
>> Thanks for this idea,
>>
>> --
>>  Bastien
>>
>
>

[-- Attachment #2: Type: text/html, Size: 2191 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 10:39   ` Noah Slater
  2014-04-17 10:41     ` Noah Slater
@ 2014-04-17 10:55     ` Bastien
  2014-04-17 10:57       ` Noah Slater
  1 sibling, 1 reply; 23+ messages in thread
From: Bastien @ 2014-04-17 10:55 UTC (permalink / raw)
  To: Noah Slater; +Cc: emacs-orgmode

Noah Slater <nslater@tumbolia.org> writes:

> Oh, funny. I had already patched this locally. I picked "e" for "tim
> [e]".
>
> Using your version, I get an error:
>
> "sort: Wrong type argument: number-or-marker-p, (10426 . 10437)"

I don't have this error.  Did you reload Org correctly?

-- 
 Bastien

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 10:55     ` Bastien
@ 2014-04-17 10:57       ` Noah Slater
  2014-04-17 11:00         ` Bastien
  0 siblings, 1 reply; 23+ messages in thread
From: Noah Slater @ 2014-04-17 10:57 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

I guess not. How does one do that?


On 17 April 2014 12:55, Bastien <bzg@gnu.org> wrote:

> Noah Slater <nslater@tumbolia.org> writes:
>
> > Oh, funny. I had already patched this locally. I picked "e" for "tim
> > [e]".
> >
> > Using your version, I get an error:
> >
> > "sort: Wrong type argument: number-or-marker-p, (10426 . 10437)"
>
> I don't have this error.  Did you reload Org correctly?
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 926 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 10:41     ` Noah Slater
@ 2014-04-17 11:00       ` Bastien
  0 siblings, 0 replies; 23+ messages in thread
From: Bastien @ 2014-04-17 11:00 UTC (permalink / raw)
  To: Noah Slater; +Cc: emacs-orgmode

Noah Slater <nslater@tumbolia.org> writes:

> Also, something I was hoping to look at was that when I sort, it
> expand all the nodes, including all of the :LOGBOOK: draws.

(add-hook 'org-after-sorting-entries-or-items-hook
          (lambda() (org-cycle-hide-drawers 'children)))

should od.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 10:57       ` Noah Slater
@ 2014-04-17 11:00         ` Bastien
  2014-04-17 11:02           ` Noah Slater
  0 siblings, 1 reply; 23+ messages in thread
From: Bastien @ 2014-04-17 11:00 UTC (permalink / raw)
  To: Noah Slater; +Cc: emacs-orgmode

Noah Slater <nslater@tumbolia.org> writes:

> I guess not. How does one do that?

M-x org-reload RET

-- 
 Bastien

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 11:00         ` Bastien
@ 2014-04-17 11:02           ` Noah Slater
  2014-04-17 11:20             ` Bastien
  0 siblings, 1 reply; 23+ messages in thread
From: Noah Slater @ 2014-04-17 11:02 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 389 bytes --]

I'm still getting this error! :/

Happy to provide any sort of debug/version/setup info you need.

I'm on IRC as nslater in #org-mode, if that is more convenient for you.

Thank you so much for the help!


On 17 April 2014 13:00, Bastien <bzg@gnu.org> wrote:

> Noah Slater <nslater@tumbolia.org> writes:
>
> > I guess not. How does one do that?
>
> M-x org-reload RET
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 919 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 11:02           ` Noah Slater
@ 2014-04-17 11:20             ` Bastien
  2014-04-17 11:33               ` Noah Slater
  0 siblings, 1 reply; 23+ messages in thread
From: Bastien @ 2014-04-17 11:20 UTC (permalink / raw)
  To: Noah Slater; +Cc: emacs-orgmode

Noah Slater <nslater@tumbolia.org> writes:

> I'm still getting this error! :/

Should be fixed in master.

Otherwise use (setq debug-on-error t) and send the backtrace.
Better to debug from an uncompiled version if that's possible.

> Happy to provide any sort of debug/version/setup info you need.
>
> I'm on IRC as nslater in #org-mode, if that is more convenient for
> you.

I'm never on IRC :)

> Thank you so much for the help!

You're welcome,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 11:20             ` Bastien
@ 2014-04-17 11:33               ` Noah Slater
  2014-04-17 11:55                 ` Bastien
  0 siblings, 1 reply; 23+ messages in thread
From: Noah Slater @ 2014-04-17 11:33 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]

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.

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.


On 17 April 2014 13:20, Bastien <bzg@altern.org> wrote:

> Noah Slater <nslater@tumbolia.org> writes:
>
> > I'm still getting this error! :/
>
> Should be fixed in master.
>
> Otherwise use (setq debug-on-error t) and send the backtrace.
> Better to debug from an uncompiled version if that's possible.
>
> > Happy to provide any sort of debug/version/setup info you need.
> >
> > I'm on IRC as nslater in #org-mode, if that is more convenient for
> > you.
>
> I'm never on IRC :)
>
> > Thank you so much for the help!
>
> You're welcome,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 1946 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 11:33               ` Noah Slater
@ 2014-04-17 11:55                 ` Bastien
  2014-04-17 12:02                   ` Noah Slater
  0 siblings, 1 reply; 23+ messages in thread
From: Bastien @ 2014-04-17 11:55 UTC (permalink / raw)
  To: Noah Slater; +Cc: emacs-orgmode

Noah Slater <nslater@tumbolia.org> 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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 11:55                 ` Bastien
@ 2014-04-17 12:02                   ` Noah Slater
  2014-04-17 12:20                     ` Noah Slater
  2014-04-17 12:26                     ` Bastien
  0 siblings, 2 replies; 23+ messages in thread
From: Noah Slater @ 2014-04-17 12:02 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1610 bytes --]

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 <bzg@gnu.org> wrote:

> Noah Slater <nslater@tumbolia.org> 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
>

[-- Attachment #2: Type: text/html, Size: 2314 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 12:02                   ` Noah Slater
@ 2014-04-17 12:20                     ` Noah Slater
  2014-04-17 12:25                       ` Bastien
  2014-04-17 12:26                     ` Bastien
  1 sibling, 1 reply; 23+ messages in thread
From: Noah Slater @ 2014-04-17 12:20 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2027 bytes --]

Actually. What I want, I think, is a function that sorts the whole buffer
and then collapses all nodes.

I think your my-hide-all-drawers-in-current-subtree thing will take care of
collapsing all nodes. But I'm now on StackOverflow trying to work out how
to sort the whole buffer.


On 17 April 2014 14:02, Noah Slater <nslater@tumbolia.org> wrote:

> 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 <bzg@gnu.org> wrote:
>
>> Noah Slater <nslater@tumbolia.org> 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
>>
>
>

[-- Attachment #2: Type: text/html, Size: 3029 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 12:20                     ` Noah Slater
@ 2014-04-17 12:25                       ` Bastien
  0 siblings, 0 replies; 23+ messages in thread
From: Bastien @ 2014-04-17 12:25 UTC (permalink / raw)
  To: Noah Slater; +Cc: emacs-orgmode

Noah Slater <nslater@tumbolia.org> writes:

> I think your my-hide-all-drawers-in-current-subtree thing will take
> care of collapsing all nodes. But I'm now on StackOverflow trying to
> work out how to sort the whole buffer.

C-x h C-c ^ should do.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 12:02                   ` Noah Slater
  2014-04-17 12:20                     ` Noah Slater
@ 2014-04-17 12:26                     ` Bastien
  2014-04-17 12:34                       ` Noah Slater
  1 sibling, 1 reply; 23+ messages in thread
From: Bastien @ 2014-04-17 12:26 UTC (permalink / raw)
  To: Noah Slater; +Cc: emacs-orgmode

Noah Slater <nslater@tumbolia.org> writes:

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

You can use my paypal account: bastien.guerry@free.fr

Thanks!

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

Well, quite long explanations would follow... I'll let you discover by
reading the code and by trial-and-error for now, need to run!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 12:26                     ` Bastien
@ 2014-04-17 12:34                       ` Noah Slater
  2014-04-17 12:45                         ` Noah Slater
  2014-04-17 14:45                         ` Bastien
  0 siblings, 2 replies; 23+ messages in thread
From: Noah Slater @ 2014-04-17 12:34 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]

I came up with this:

(defun my-sort-buffer ()
  (interactive)
  (mark-whole-buffer)
  (org-sort-entries t ?K)
  (org-overview))

Seems to do what I want. This is most excellent. Making some great progress
here. Thanks. And I will send you a token of my gratitude at the end of the
month, when I have funds available.




On 17 April 2014 14:26, Bastien <bzg@gnu.org> wrote:

> Noah Slater <nslater@tumbolia.org> writes:
>
> > 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!
>
> You can use my paypal account: bastien.guerry@free.fr
>
> Thanks!
>
> > 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?
>
> Well, quite long explanations would follow... I'll let you discover by
> reading the code and by trial-and-error for now, need to run!
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 1815 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 12:34                       ` Noah Slater
@ 2014-04-17 12:45                         ` Noah Slater
  2014-04-17 14:42                           ` Noah Slater
  2014-04-17 14:45                         ` Bastien
  1 sibling, 1 reply; 23+ messages in thread
From: Noah Slater @ 2014-04-17 12:45 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1331 bytes --]

Actually, I renamed this my-overview, added (org-clock-display), and bound
it to C-c o. Very swish.


On 17 April 2014 14:34, Noah Slater <nslater@tumbolia.org> wrote:

> I came up with this:
>
> (defun my-sort-buffer ()
>   (interactive)
>   (mark-whole-buffer)
>   (org-sort-entries t ?K)
>   (org-overview))
>
> Seems to do what I want. This is most excellent. Making some great
> progress here. Thanks. And I will send you a token of my gratitude at the
> end of the month, when I have funds available.
>
>
>
>
> On 17 April 2014 14:26, Bastien <bzg@gnu.org> wrote:
>
>> Noah Slater <nslater@tumbolia.org> writes:
>>
>> > 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!
>>
>> You can use my paypal account: bastien.guerry@free.fr
>>
>> Thanks!
>>
>> > 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?
>>
>> Well, quite long explanations would follow... I'll let you discover by
>> reading the code and by trial-and-error for now, need to run!
>>
>> --
>>  Bastien
>>
>
>

[-- Attachment #2: Type: text/html, Size: 2337 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 12:45                         ` Noah Slater
@ 2014-04-17 14:42                           ` Noah Slater
  2014-04-17 15:05                             ` Bastien
  2014-04-18  0:09                             ` Sacha Chua
  0 siblings, 2 replies; 23+ messages in thread
From: Noah Slater @ 2014-04-17 14:42 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1643 bytes --]

Using this a bit, it doesn't quite do what I want it to do.

Is there any way to sort recursively?

At the moment, calling org-sort-entries on the whole buffer only sorts the
top level nodes.


On 17 April 2014 14:45, Noah Slater <nslater@tumbolia.org> wrote:

> Actually, I renamed this my-overview, added (org-clock-display), and bound
> it to C-c o. Very swish.
>
>
> On 17 April 2014 14:34, Noah Slater <nslater@tumbolia.org> wrote:
>
>> I came up with this:
>>
>> (defun my-sort-buffer ()
>>   (interactive)
>>   (mark-whole-buffer)
>>   (org-sort-entries t ?K)
>>   (org-overview))
>>
>> Seems to do what I want. This is most excellent. Making some great
>> progress here. Thanks. And I will send you a token of my gratitude at the
>> end of the month, when I have funds available.
>>
>>
>>
>>
>> On 17 April 2014 14:26, Bastien <bzg@gnu.org> wrote:
>>
>>> Noah Slater <nslater@tumbolia.org> writes:
>>>
>>> > 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!
>>>
>>> You can use my paypal account: bastien.guerry@free.fr
>>>
>>> Thanks!
>>>
>>> > 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?
>>>
>>> Well, quite long explanations would follow... I'll let you discover by
>>> reading the code and by trial-and-error for now, need to run!
>>>
>>> --
>>>  Bastien
>>>
>>
>>
>

[-- Attachment #2: Type: text/html, Size: 2982 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 12:34                       ` Noah Slater
  2014-04-17 12:45                         ` Noah Slater
@ 2014-04-17 14:45                         ` Bastien
  1 sibling, 0 replies; 23+ messages in thread
From: Bastien @ 2014-04-17 14:45 UTC (permalink / raw)
  To: Noah Slater; +Cc: emacs-orgmode

Noah Slater <nslater@tumbolia.org> writes:

> Seems to do what I want. This is most excellent. Making some great
> progress here. Thanks. And I will send you a token of my gratitude at
> the end of the month, when I have funds available.

... or wait a bit more and send your gratitude as patches!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 14:42                           ` Noah Slater
@ 2014-04-17 15:05                             ` Bastien
  2014-04-18  0:09                             ` Sacha Chua
  1 sibling, 0 replies; 23+ messages in thread
From: Bastien @ 2014-04-17 15:05 UTC (permalink / raw)
  To: Noah Slater; +Cc: emacs-orgmode

Noah Slater <nslater@tumbolia.org> writes:

> Using this a bit, it doesn't quite do what I want it to do.
>
> Is there any way to sort recursively?

Not implemented, but you can hack around.

Anyway, "sorting recursively" sounds like a nice idea but you
probably want to just run this once in a while, not often enough
to require a core command for that.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-17 14:42                           ` Noah Slater
  2014-04-17 15:05                             ` Bastien
@ 2014-04-18  0:09                             ` Sacha Chua
  2014-04-20  9:48                               ` Noah Slater
  1 sibling, 1 reply; 23+ messages in thread
From: Sacha Chua @ 2014-04-18  0:09 UTC (permalink / raw)
  To: emacs-orgmode

Noah Slater <nslater@tumbolia.org> writes:

Hello, Noah, all!

> Using this a bit, it doesn't quite do what I want it to do.
> Is there any way to sort recursively?
> At the moment, calling org-sort-entries on the whole buffer only sorts the
> top level nodes.

Here's a rather inefficient hack (but hey, it seems to work =) ):

(defun sacha/org-sort-recursively (type)
	(org-map-entries
	 (lambda ()
		 (condition-case nil
				 (org-sort-entries nil type)
			 (error nil)))))

Call with M-: (sacha/org-sort-recursively ?K) or merge the code into
your own.

Sacha

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Sorting nodes by clocked time
  2014-04-18  0:09                             ` Sacha Chua
@ 2014-04-20  9:48                               ` Noah Slater
  0 siblings, 0 replies; 23+ messages in thread
From: Noah Slater @ 2014-04-20  9:48 UTC (permalink / raw)
  To: Sacha Chua; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 782 bytes --]

Thanks Sacha, that's great!


On 18 April 2014 02:09, Sacha Chua <sacha@sachachua.com> wrote:

> Noah Slater <nslater@tumbolia.org> writes:
>
> Hello, Noah, all!
>
> > Using this a bit, it doesn't quite do what I want it to do.
> > Is there any way to sort recursively?
> > At the moment, calling org-sort-entries on the whole buffer only sorts
> the
> > top level nodes.
>
> Here's a rather inefficient hack (but hey, it seems to work =) ):
>
> (defun sacha/org-sort-recursively (type)
>         (org-map-entries
>          (lambda ()
>                  (condition-case nil
>                                  (org-sort-entries nil type)
>                          (error nil)))))
>
> Call with M-: (sacha/org-sort-recursively ?K) or merge the code into
> your own.
>
> Sacha
>
>
>

[-- Attachment #2: Type: text/html, Size: 1306 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2014-04-20  9:48 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-07 16:44 Sorting nodes by clocked time Noah Slater
2014-04-17  8:33 ` Bastien
2014-04-17 10:39   ` Noah Slater
2014-04-17 10:41     ` Noah Slater
2014-04-17 11:00       ` Bastien
2014-04-17 10:55     ` Bastien
2014-04-17 10:57       ` Noah Slater
2014-04-17 11:00         ` Bastien
2014-04-17 11:02           ` Noah Slater
2014-04-17 11:20             ` Bastien
2014-04-17 11:33               ` Noah Slater
2014-04-17 11:55                 ` Bastien
2014-04-17 12:02                   ` Noah Slater
2014-04-17 12:20                     ` Noah Slater
2014-04-17 12:25                       ` Bastien
2014-04-17 12:26                     ` Bastien
2014-04-17 12:34                       ` Noah Slater
2014-04-17 12:45                         ` Noah Slater
2014-04-17 14:42                           ` Noah Slater
2014-04-17 15:05                             ` Bastien
2014-04-18  0:09                             ` Sacha Chua
2014-04-20  9:48                               ` Noah Slater
2014-04-17 14:45                         ` Bastien

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