emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Archiving repeated tasks under corresponding date tree for each repe


From: Gerardo Moro
Subject: Re: Archiving repeated tasks under corresponding date tree for each repeated item
Date: Tue, 17 Nov 2020 14:57:00 +0200

Thanks for the prompt reply!
I tried this but I get: "symbol's function definition is void:  org-trigger-doing"

El mar., 17 nov. 2020 a las 14:32, Ihor Radchenko (<yantar92@gmail.com>) escribió:
> Thanks, I don't know how to go about doing that, so I would have to rely on
> others wanting to help me if they consider this to be also useful to them
> (which I definitely think it is!).

Try the following code. It should archive any repeated task once it is
marked DONE.

(defun org-archive-repeated-task (arg)
  "Add a copy of the recurring task marked DONE to archive."
  (when (and (eq (plist-get arg :type) 'todo-state-change)
             (string= (plist-get arg :to) "DONE")) ;; The state is changed to DONE
    (let* ((pos (plist-get arg :position))
           (repeater (org-with-point-at pos (org-get-repeat))))
      (when repeater ;; Only consider tasks with repeater timestamp anywhere in the task body
        (my/org-archive-without-delete)))))
(add-hook 'org-trigger-hook #'org-trigger-doing)

Best,
Ihor

Gerardo Moro <gerardomoro37@gmail.com> writes:

> Thanks, I don't know how to go about doing that, so I would have to rely on
> others wanting to help me if they consider this to be also useful to them
> (which I definitely think it is!).
>
> El mar., 17 nov. 2020 a las 11:32, Ihor Radchenko (<yantar92@gmail.com>)
> escribió:
>
>> > I actually now realized that your function will not unfortunately archive
>> > each logged item (those located in the logbook) in its corresponding date
>> > (!).
>> > What it will do is to archive the whole tree under today's date without
>> > deleting it from the original org file.
>>
>> You are right. It is expected behaviour. That's why I suggested to run
>> it in org-trigger-hook, which will trigger at the day and time when you
>> mark the task DONE.
>>
>> Best,
>> Ihor
>>
>> Gerardo Moro <gerardomoro37@gmail.com> writes:
>>
>> > Hi again,
>> >
>> > I actually now realized that your function will not unfortunately archive
>> > each logged item (those located in the logbook) in its corresponding date
>> > (!).
>> > What it will do is to archive the whole tree under today's date without
>> > deleting it from the original org file.
>> >
>> > For instance,
>> >
>> > * TODO REPEATED TASK SAMPLE
>> >   SCHEDULED: <2020-11-30 Mon +20d>
>> >   :PROPERTIES:
>> >   :STYLE:    habit
>> >   :LAST_REPEAT: [2020-11-09 Mon 22:28]
>> >   :END:
>> > :LOGBOOK:
>> > - State "DONE"       from "TODO"       [2020-11-15 Sun 22:28]
>> > - State "DONE"       from "STARTED"    [2020-11-14 Sat 22:17]
>> > - State "DONE"       from "STARTED"    [2020-11-13 Fri 22:17]
>> > - State "DONE"       from "STARTED"    [2020-11-11 Wed 22:17]
>> >
>> > If I position myself in any point in this entry, when I execute the
>> > function it will archive the whole tree+subtree under today's date (the
>> > date when it was archived).
>> > The behaviour I was expecting is to archive each of the logged tasks
>> under
>> > their corresponding date (on the 11th, 13th, 14th and 15th of November).
>> > Just to be clear :)
>> > G
>> >
>> > El lun., 16 nov. 2020 a las 17:21, Gerardo Moro (<
>> gerardomoro37@gmail.com>)
>> > escribió:
>> >
>>

reply via email to

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