unofficial mirror of emacs-orgmode@gnu.org
 help / color / mirror / Atom feed
* Archiving repeated tasks under corresponding date tree for each repeated item
       [not found] <CAF4Fj9hjjQ98gGe7hRp0tU4qPtZ-ekUUpO9niNpJ+s31g2buOA@mail.gmail.com>
@ 2020-10-24  4:06 ` Gerardo Moro
  2020-10-29  7:01   ` Gerardo Moro
  0 siblings, 1 reply; 18+ messages in thread
From: Gerardo Moro @ 2020-10-24  4:06 UTC (permalink / raw)
  To: emacs-orgmode

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

Dear all,

When I archive a repeated task (let's say, a learning project of 15 minutes
every Wednesday day for 2 months), the task gets archived in a date tree
all under the day it was closed (cancelled) as a whole. This means that all
the LOGGED individual instances of repetition are archived on the day the
project got completed. It would be great if each of these individual "task
happenings" were archived under the date and time they were completed
individually, and not just all as one block. This way I could get weekly
reviews that take those into account. Not sure if I made myself understood!
:))

Thanks!
G

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

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

* Archiving repeated tasks under corresponding date tree for each repeated item
  2020-10-24  4:06 ` Archiving repeated tasks under corresponding date tree for each repeated item Gerardo Moro
@ 2020-10-29  7:01   ` Gerardo Moro
  2020-11-02 14:18     ` Julius Dittmar
  2020-11-03  5:52     ` Ihor Radchenko
  0 siblings, 2 replies; 18+ messages in thread
From: Gerardo Moro @ 2020-10-29  7:01 UTC (permalink / raw)
  To: emacs-orgmode

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

Dear all,

I am resending this as I believe it's a useful concept to implement,
especially by those who track their tasks and do weekly/monthly reviews.

When I archive a repeated task (let's say, a learning project of 15 minutes
every Wednesday day for 2 months), the task gets archived in a date tree
all under the day it was closed (cancelled) as a whole. This means that all
the LOGGED individual instances of repetition are archived on the day the
project got completed. It would be great if each of these individual "task
happenings" were archived under the date and time they were completed
individually, and not just all as one block. This way I could get weekly
reviews that take those into account. Not sure if I made myself understood!
:))

Thanks!
G

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

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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-10-29  7:01   ` Gerardo Moro
@ 2020-11-02 14:18     ` Julius Dittmar
  2020-11-03  5:52     ` Ihor Radchenko
  1 sibling, 0 replies; 18+ messages in thread
From: Julius Dittmar @ 2020-11-02 14:18 UTC (permalink / raw)
  To: emacs-orgmode

Hi Gerardo,

I am by far no expert, but I think with the kind of setup you currently
use your goal cannot be reached: The repeating task you use is one
single task, and it will be archived as that one single task.

There's a different way to approach repeating tasks though that might
meet your requirements: Copying that task for each repeat. There's a
command (org-clone-subtree-with-time-shift) that lets you copy a task
easily. With that you have different tasks that can be archived separately.

I did never use this approach myself though.

Perhaps that helps,

Julius Dittmar


Am 29.10.20 um 08:01 schrieb Gerardo Moro:
> When I archive a repeated task (let's say, a learning project of 15 minutes
> every Wednesday day for 2 months), the task gets archived in a date tree
> all under the day it was closed (cancelled) as a whole. This means that all
> the LOGGED individual instances of repetition are archived on the day the
> project got completed. It would be great if each of these individual "task
> happenings" were archived under the date and time they were completed
> individually, and not just all as one block. This way I could get weekly
> reviews that take those into account.


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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-10-29  7:01   ` Gerardo Moro
  2020-11-02 14:18     ` Julius Dittmar
@ 2020-11-03  5:52     ` Ihor Radchenko
  2020-11-12  7:59       ` Gerardo Moro
  1 sibling, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2020-11-03  5:52 UTC (permalink / raw)
  To: Gerardo Moro, emacs-orgmode

> It would be great if each of these individual "task
> happenings" were archived under the date and time they were completed
> individually, and not just all as one block. This way I could get weekly
> reviews that take those into account.

What about trying to do your weekly review using org-agenda? You can
show the task every day you complete it by enabling org-agenda-log-mode
in your weekly agenda (v l). If your tasks are also archived regularly,
you may also need "v A" to include archive files into agenda view.

Best,
Ihor


Gerardo Moro <gerardomoro37@gmail.com> writes:

> Dear all,
>
> I am resending this as I believe it's a useful concept to implement,
> especially by those who track their tasks and do weekly/monthly reviews.
>
> When I archive a repeated task (let's say, a learning project of 15 minutes
> every Wednesday day for 2 months), the task gets archived in a date tree
> all under the day it was closed (cancelled) as a whole. This means that all
> the LOGGED individual instances of repetition are archived on the day the
> project got completed. It would be great if each of these individual "task
> happenings" were archived under the date and time they were completed
> individually, and not just all as one block. This way I could get weekly
> reviews that take those into account. Not sure if I made myself understood!
> :))
>
> Thanks!
> G


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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-11-03  5:52     ` Ihor Radchenko
@ 2020-11-12  7:59       ` Gerardo Moro
  2020-11-12 10:27         ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Gerardo Moro @ 2020-11-12  7:59 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

Thanks, Ihor.
Indeed, that is an excellent feature of agenda. I use it sometimes  to
visualize what I have DONE during the week on the sopt.
What I aim to accomplish however is a more systematic log of all the DONE
tasks, this is, to have an archive file where to archive all tasks.
This file is in the format:

2020
   2020-01-01 DONE task1
   2020-01-12 DONE task2
   2020-02-01 CANCELLED task3

So it is indeed a datetree file where I can revisit the past :) if you will.
The problem with habits and repeated tasks is that they don't get archived
when DONE...
They get archived once the task is cancelled or completed as a whole, all
under the day the task stopped continuing, under which I have all the
logged individual completion.
It would be desirable to have each "completion" archived under its
corresponding datetree, it is more meaningful :)

Hope it is clear now, thanks so much for any help!
GM
So even if I have beeng doing the task every wednesday for a year, it won't
be archived

El mar., 3 nov. 2020 a las 7:53, Ihor Radchenko (<yantar92@gmail.com>)
escribió:

> > It would be great if each of these individual "task
> > happenings" were archived under the date and time they were completed
> > individually, and not just all as one block. This way I could get weekly
> > reviews that take those into account.
>
> What about trying to do your weekly review using org-agenda? You can
> show the task every day you complete it by enabling org-agenda-log-mode
> in your weekly agenda (v l). If your tasks are also archived regularly,
> you may also need "v A" to include archive files into agenda view.
>
> Best,
> Ihor
>
>
> Gerardo Moro <gerardomoro37@gmail.com> writes:
>
> > Dear all,
> >
> > I am resending this as I believe it's a useful concept to implement,
> > especially by those who track their tasks and do weekly/monthly reviews.
> >
> > When I archive a repeated task (let's say, a learning project of 15
> minutes
> > every Wednesday day for 2 months), the task gets archived in a date tree
> > all under the day it was closed (cancelled) as a whole. This means that
> all
> > the LOGGED individual instances of repetition are archived on the day the
> > project got completed. It would be great if each of these individual
> "task
> > happenings" were archived under the date and time they were completed
> > individually, and not just all as one block. This way I could get weekly
> > reviews that take those into account. Not sure if I made myself
> understood!
> > :))
> >
> > Thanks!
> > G
>

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

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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-11-12  7:59       ` Gerardo Moro
@ 2020-11-12 10:27         ` Ihor Radchenko
  2020-11-16 15:21           ` Gerardo Moro
  0 siblings, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2020-11-12 10:27 UTC (permalink / raw)
  To: Gerardo Moro; +Cc: emacs-orgmode

> Hope it is clear now, thanks so much for any help!

Sorry for not making my previous email more clear. I actually understood
what you want to achieve. My suggestion was rather an alternative
approach to "revisit the past" - you can always build agenda view for a
specific date (or range of dates) in the past. That way, you would not
need to look into archive file manually at all.

On your actual question, I think I found some old reddit comment [1] that
may be relevant. The code provides a new command to archive an org
headline without actually deleting it. That way, you will get a copy of
your headline on the date of archival. Below is the original code with
me adding docstrings for more clarity.

(defun my/org-archive-delete-logbook ()
"Delete LOGBOOK of the entry at point. It is obsolete once the copy of
the item is moved to the archive file."
  (save-excursion
   (org-end-of-meta-data)
   (let ((elm (org-element-at-point)))
     (when (and
            (equal (org-element-type elm) 'drawer)
            (equal (org-element-property :drawer-name elm) "LOGBOOK"))
       (delete-region (org-element-property :begin elm)
                      (org-element-property :end elm))))))

(defun my/org-archive-without-delete ()
"Archive item at point, but do not actually delete it."
  (cl-letf (((symbol-function 'org-cut-subtree) (lambda () nil)))
    (org-archive-subtree)))

(defun my/org-archive-logbook ()
"Create an archive copy of subtree at point and delete LOGBOOK in the
first headline of the subtree."
  (interactive)
  (my/org-archive-without-delete)
  (my/org-archive-delete-logbook))

I think you can modify the last function and call it in
org-trigger-hook, so that repeating items would be archived without
deleting every time you mark the item DONE.

[1] https://old.reddit.com/r/orgmode/comments/dg43hs/can_i_archive_a_property_drawer/f3frk2n/

Best,
Ihor

Gerardo Moro <gerardomoro37@gmail.com> writes:

> Thanks, Ihor.
> Indeed, that is an excellent feature of agenda. I use it sometimes  to
> visualize what I have DONE during the week on the sopt.
> What I aim to accomplish however is a more systematic log of all the DONE
> tasks, this is, to have an archive file where to archive all tasks.
> This file is in the format:
>
> 2020
>    2020-01-01 DONE task1
>    2020-01-12 DONE task2
>    2020-02-01 CANCELLED task3
>
> So it is indeed a datetree file where I can revisit the past :) if you will.
> The problem with habits and repeated tasks is that they don't get archived
> when DONE...
> They get archived once the task is cancelled or completed as a whole, all
> under the day the task stopped continuing, under which I have all the
> logged individual completion.
> It would be desirable to have each "completion" archived under its
> corresponding datetree, it is more meaningful :)
>
> Hope it is clear now, thanks so much for any help!
> GM
> So even if I have beeng doing the task every wednesday for a year, it won't
> be archived
>
> El mar., 3 nov. 2020 a las 7:53, Ihor Radchenko (<yantar92@gmail.com>)
> escribió:
>
>> > It would be great if each of these individual "task
>> > happenings" were archived under the date and time they were completed
>> > individually, and not just all as one block. This way I could get weekly
>> > reviews that take those into account.
>>
>> What about trying to do your weekly review using org-agenda? You can
>> show the task every day you complete it by enabling org-agenda-log-mode
>> in your weekly agenda (v l). If your tasks are also archived regularly,
>> you may also need "v A" to include archive files into agenda view.
>>
>> Best,
>> Ihor
>>
>>
>> Gerardo Moro <gerardomoro37@gmail.com> writes:
>>
>> > Dear all,
>> >
>> > I am resending this as I believe it's a useful concept to implement,
>> > especially by those who track their tasks and do weekly/monthly reviews.
>> >
>> > When I archive a repeated task (let's say, a learning project of 15
>> minutes
>> > every Wednesday day for 2 months), the task gets archived in a date tree
>> > all under the day it was closed (cancelled) as a whole. This means that
>> all
>> > the LOGGED individual instances of repetition are archived on the day the
>> > project got completed. It would be great if each of these individual
>> "task
>> > happenings" were archived under the date and time they were completed
>> > individually, and not just all as one block. This way I could get weekly
>> > reviews that take those into account. Not sure if I made myself
>> understood!
>> > :))
>> >
>> > Thanks!
>> > G
>>


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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-11-12 10:27         ` Ihor Radchenko
@ 2020-11-16 15:21           ` Gerardo Moro
  2020-11-17  8:58             ` Gerardo Moro
  0 siblings, 1 reply; 18+ messages in thread
From: Gerardo Moro @ 2020-11-16 15:21 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

Wow, I’m impressed by your help, you are very kind!
I am also impressed by your researching skills, I gave a long go at trying
to find some code online unsuccessfully.

Yes, I agree that the agenda is a nice way to go to visualize my past
events (with v A).
My idea of not relying on the agenda interface is just to be free and have
an archive org file with all my entries, easier to scroll from any device
without the need of Emacs.

As for the function to archive the individual repeated tasks into their
corresponding tree:
I’m not an emacs lisp programmer (or any kind of!). As I see, this function
works only “at point”.
The way I work is I mark tasks as DONE during a couple weeks, and then I
call this function that tracks all my org file and archives all DONE /
CANCELLED items.
This is great because I don’t have to do it one by one.

(defun my/org-archive-done-tasks-file ()
  (interactive)
  (org-map-entries
   (lambda ()
     (org-archive-subtree)
     (setq org-map-continue-from (outline-previous-heading)))
     "TODO=\"DONE\"|TODO=\"CANCELED\\"" 'file))

Do you think there is a way to combine these two functions so that when I
call the fucntion, I get to archive all DONE/CANCELLED & repeated
DONE/CANCELLED tasks (the latter without deleting the logged task or its
respective heading)?

Best,
G.

El jue., 12 nov. 2020 a las 12:28, Ihor Radchenko (<yantar92@gmail.com>)
escribió:

> > Hope it is clear now, thanks so much for any help!
>
> Sorry for not making my previous email more clear. I actually understood
> what you want to achieve. My suggestion was rather an alternative
> approach to "revisit the past" - you can always build agenda view for a
> specific date (or range of dates) in the past. That way, you would not
> need to look into archive file manually at all.
>
> On your actual question, I think I found some old reddit comment [1] that
> may be relevant. The code provides a new command to archive an org
> headline without actually deleting it. That way, you will get a copy of
> your headline on the date of archival. Below is the original code with
> me adding docstrings for more clarity.
>
> (defun my/org-archive-delete-logbook ()
> "Delete LOGBOOK of the entry at point. It is obsolete once the copy of
> the item is moved to the archive file."
>   (save-excursion
>    (org-end-of-meta-data)
>    (let ((elm (org-element-at-point)))
>      (when (and
>             (equal (org-element-type elm) 'drawer)
>             (equal (org-element-property :drawer-name elm) "LOGBOOK"))
>        (delete-region (org-element-property :begin elm)
>                       (org-element-property :end elm))))))
>
> (defun my/org-archive-without-delete ()
> "Archive item at point, but do not actually delete it."
>   (cl-letf (((symbol-function 'org-cut-subtree) (lambda () nil)))
>     (org-archive-subtree)))
>
> (defun my/org-archive-logbook ()
> "Create an archive copy of subtree at point and delete LOGBOOK in the
> first headline of the subtree."
>   (interactive)
>   (my/org-archive-without-delete)
>   (my/org-archive-delete-logbook))
>
> I think you can modify the last function and call it in
> org-trigger-hook, so that repeating items would be archived without
> deleting every time you mark the item DONE.
>
> [1]
> https://old.reddit.com/r/orgmode/comments/dg43hs/can_i_archive_a_property_drawer/f3frk2n/
>
> Best,
> Ihor
>
> Gerardo Moro <gerardomoro37@gmail.com> writes:
>
> > Thanks, Ihor.
> > Indeed, that is an excellent feature of agenda. I use it sometimes  to
> > visualize what I have DONE during the week on the sopt.
> > What I aim to accomplish however is a more systematic log of all the DONE
> > tasks, this is, to have an archive file where to archive all tasks.
> > This file is in the format:
> >
> > 2020
> >    2020-01-01 DONE task1
> >    2020-01-12 DONE task2
> >    2020-02-01 CANCELLED task3
> >
> > So it is indeed a datetree file where I can revisit the past :) if you
> will.
> > The problem with habits and repeated tasks is that they don't get
> archived
> > when DONE...
> > They get archived once the task is cancelled or completed as a whole, all
> > under the day the task stopped continuing, under which I have all the
> > logged individual completion.
> > It would be desirable to have each "completion" archived under its
> > corresponding datetree, it is more meaningful :)
> >
> > Hope it is clear now, thanks so much for any help!
> > GM
> > So even if I have beeng doing the task every wednesday for a year, it
> won't
> > be archived
> >
> > El mar., 3 nov. 2020 a las 7:53, Ihor Radchenko (<yantar92@gmail.com>)
> > escribió:
> >
> >> > It would be great if each of these individual "task
> >> > happenings" were archived under the date and time they were completed
> >> > individually, and not just all as one block. This way I could get
> weekly
> >> > reviews that take those into account.
> >>
> >> What about trying to do your weekly review using org-agenda? You can
> >> show the task every day you complete it by enabling org-agenda-log-mode
> >> in your weekly agenda (v l). If your tasks are also archived regularly,
> >> you may also need "v A" to include archive files into agenda view.
> >>
> >> Best,
> >> Ihor
> >>
> >>
> >> Gerardo Moro <gerardomoro37@gmail.com> writes:
> >>
> >> > Dear all,
> >> >
> >> > I am resending this as I believe it's a useful concept to implement,
> >> > especially by those who track their tasks and do weekly/monthly
> reviews.
> >> >
> >> > When I archive a repeated task (let's say, a learning project of 15
> >> minutes
> >> > every Wednesday day for 2 months), the task gets archived in a date
> tree
> >> > all under the day it was closed (cancelled) as a whole. This means
> that
> >> all
> >> > the LOGGED individual instances of repetition are archived on the day
> the
> >> > project got completed. It would be great if each of these individual
> >> "task
> >> > happenings" were archived under the date and time they were completed
> >> > individually, and not just all as one block. This way I could get
> weekly
> >> > reviews that take those into account. Not sure if I made myself
> >> understood!
> >> > :))
> >> >
> >> > Thanks!
> >> > G
> >>
>

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

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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-11-16 15:21           ` Gerardo Moro
@ 2020-11-17  8:58             ` Gerardo Moro
  2020-11-17  9:31               ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Gerardo Moro @ 2020-11-17  8:58 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

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ó:

> Wow, I’m impressed by your help, you are very kind!
> I am also impressed by your researching skills, I gave a long go at trying
> to find some code online unsuccessfully.
>
> Yes, I agree that the agenda is a nice way to go to visualize my past
> events (with v A).
> My idea of not relying on the agenda interface is just to be free and have
> an archive org file with all my entries, easier to scroll from any device
> without the need of Emacs.
>
> As for the function to archive the individual repeated tasks into their
> corresponding tree:
> I’m not an emacs lisp programmer (or any kind of!). As I see, this
> function works only “at point”.
> The way I work is I mark tasks as DONE during a couple weeks, and then I
> call this function that tracks all my org file and archives all DONE /
> CANCELLED items.
> This is great because I don’t have to do it one by one.
>
> (defun my/org-archive-done-tasks-file ()
>   (interactive)
>   (org-map-entries
>    (lambda ()
>      (org-archive-subtree)
>      (setq org-map-continue-from (outline-previous-heading)))
>      "TODO=\"DONE\"|TODO=\"CANCELED\\"" 'file))
>
> Do you think there is a way to combine these two functions so that when I
> call the fucntion, I get to archive all DONE/CANCELLED & repeated
> DONE/CANCELLED tasks (the latter without deleting the logged task or its
> respective heading)?
>
> Best,
> G.
>
> El jue., 12 nov. 2020 a las 12:28, Ihor Radchenko (<yantar92@gmail.com>)
> escribió:
>
>> > Hope it is clear now, thanks so much for any help!
>>
>> Sorry for not making my previous email more clear. I actually understood
>> what you want to achieve. My suggestion was rather an alternative
>> approach to "revisit the past" - you can always build agenda view for a
>> specific date (or range of dates) in the past. That way, you would not
>> need to look into archive file manually at all.
>>
>> On your actual question, I think I found some old reddit comment [1] that
>> may be relevant. The code provides a new command to archive an org
>> headline without actually deleting it. That way, you will get a copy of
>> your headline on the date of archival. Below is the original code with
>> me adding docstrings for more clarity.
>>
>> (defun my/org-archive-delete-logbook ()
>> "Delete LOGBOOK of the entry at point. It is obsolete once the copy of
>> the item is moved to the archive file."
>>   (save-excursion
>>    (org-end-of-meta-data)
>>    (let ((elm (org-element-at-point)))
>>      (when (and
>>             (equal (org-element-type elm) 'drawer)
>>             (equal (org-element-property :drawer-name elm) "LOGBOOK"))
>>        (delete-region (org-element-property :begin elm)
>>                       (org-element-property :end elm))))))
>>
>> (defun my/org-archive-without-delete ()
>> "Archive item at point, but do not actually delete it."
>>   (cl-letf (((symbol-function 'org-cut-subtree) (lambda () nil)))
>>     (org-archive-subtree)))
>>
>> (defun my/org-archive-logbook ()
>> "Create an archive copy of subtree at point and delete LOGBOOK in the
>> first headline of the subtree."
>>   (interactive)
>>   (my/org-archive-without-delete)
>>   (my/org-archive-delete-logbook))
>>
>> I think you can modify the last function and call it in
>> org-trigger-hook, so that repeating items would be archived without
>> deleting every time you mark the item DONE.
>>
>> [1]
>> https://old.reddit.com/r/orgmode/comments/dg43hs/can_i_archive_a_property_drawer/f3frk2n/
>>
>> Best,
>> Ihor
>>
>> Gerardo Moro <gerardomoro37@gmail.com> writes:
>>
>> > Thanks, Ihor.
>> > Indeed, that is an excellent feature of agenda. I use it sometimes  to
>> > visualize what I have DONE during the week on the sopt.
>> > What I aim to accomplish however is a more systematic log of all the
>> DONE
>> > tasks, this is, to have an archive file where to archive all tasks.
>> > This file is in the format:
>> >
>> > 2020
>> >    2020-01-01 DONE task1
>> >    2020-01-12 DONE task2
>> >    2020-02-01 CANCELLED task3
>> >
>> > So it is indeed a datetree file where I can revisit the past :) if you
>> will.
>> > The problem with habits and repeated tasks is that they don't get
>> archived
>> > when DONE...
>> > They get archived once the task is cancelled or completed as a whole,
>> all
>> > under the day the task stopped continuing, under which I have all the
>> > logged individual completion.
>> > It would be desirable to have each "completion" archived under its
>> > corresponding datetree, it is more meaningful :)
>> >
>> > Hope it is clear now, thanks so much for any help!
>> > GM
>> > So even if I have beeng doing the task every wednesday for a year, it
>> won't
>> > be archived
>> >
>> > El mar., 3 nov. 2020 a las 7:53, Ihor Radchenko (<yantar92@gmail.com>)
>> > escribió:
>> >
>> >> > It would be great if each of these individual "task
>> >> > happenings" were archived under the date and time they were completed
>> >> > individually, and not just all as one block. This way I could get
>> weekly
>> >> > reviews that take those into account.
>> >>
>> >> What about trying to do your weekly review using org-agenda? You can
>> >> show the task every day you complete it by enabling org-agenda-log-mode
>> >> in your weekly agenda (v l). If your tasks are also archived regularly,
>> >> you may also need "v A" to include archive files into agenda view.
>> >>
>> >> Best,
>> >> Ihor
>> >>
>> >>
>> >> Gerardo Moro <gerardomoro37@gmail.com> writes:
>> >>
>> >> > Dear all,
>> >> >
>> >> > I am resending this as I believe it's a useful concept to implement,
>> >> > especially by those who track their tasks and do weekly/monthly
>> reviews.
>> >> >
>> >> > When I archive a repeated task (let's say, a learning project of 15
>> >> minutes
>> >> > every Wednesday day for 2 months), the task gets archived in a date
>> tree
>> >> > all under the day it was closed (cancelled) as a whole. This means
>> that
>> >> all
>> >> > the LOGGED individual instances of repetition are archived on the
>> day the
>> >> > project got completed. It would be great if each of these individual
>> >> "task
>> >> > happenings" were archived under the date and time they were completed
>> >> > individually, and not just all as one block. This way I could get
>> weekly
>> >> > reviews that take those into account. Not sure if I made myself
>> >> understood!
>> >> > :))
>> >> >
>> >> > Thanks!
>> >> > G
>> >>
>>
>

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

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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-11-17  8:58             ` Gerardo Moro
@ 2020-11-17  9:31               ` Ihor Radchenko
  2020-11-17 12:00                 ` Gerardo Moro
  0 siblings, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2020-11-17  9:31 UTC (permalink / raw)
  To: Gerardo Moro; +Cc: emacs-orgmode

> 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ó:
>


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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-11-17  9:31               ` Ihor Radchenko
@ 2020-11-17 12:00                 ` Gerardo Moro
  2020-11-17 12:31                   ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Gerardo Moro @ 2020-11-17 12:00 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

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ó:
> >
>

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

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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-11-17 12:00                 ` Gerardo Moro
@ 2020-11-17 12:31                   ` Ihor Radchenko
  2020-11-17 12:57                     ` Gerardo Moro
  0 siblings, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2020-11-17 12:31 UTC (permalink / raw)
  To: Gerardo Moro; +Cc: emacs-orgmode

> 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ó:
>> >
>>


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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-11-17 12:31                   ` Ihor Radchenko
@ 2020-11-17 12:57                     ` Gerardo Moro
  2020-11-17 13:12                       ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Gerardo Moro @ 2020-11-17 12:57 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

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ó:
> >> >
> >>
>

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

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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-11-17 12:57                     ` Gerardo Moro
@ 2020-11-17 13:12                       ` Ihor Radchenko
  2020-11-17 15:35                         ` Gerardo Moro
  0 siblings, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2020-11-17 13:12 UTC (permalink / raw)
  To: Gerardo Moro; +Cc: emacs-orgmode

> I tried this but I get: "symbol's function definition is void:
>  org-trigger-doing"

Oops. That's the old function name. Should be

(add-hook 'org-trigger-hook #'org-archive-repeated-task)

Best,
Ihor


Gerardo Moro <gerardomoro37@gmail.com> writes:

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


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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-11-17 13:12                       ` Ihor Radchenko
@ 2020-11-17 15:35                         ` Gerardo Moro
  2020-11-17 15:59                           ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Gerardo Moro @ 2020-11-17 15:35 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

Now I get the error: "wrong number of arguments..." :D

El mar., 17 nov. 2020 a las 15:13, Ihor Radchenko (<yantar92@gmail.com>)
escribió:

> > I tried this but I get: "symbol's function definition is void:
> >  org-trigger-doing"
>
> Oops. That's the old function name. Should be
>
> (add-hook 'org-trigger-hook #'org-archive-repeated-task)
>
> Best,
> Ihor
>
>
> Gerardo Moro <gerardomoro37@gmail.com> writes:
>
> > 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
> >>
>

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

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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-11-17 15:35                         ` Gerardo Moro
@ 2020-11-17 15:59                           ` Ihor Radchenko
  2020-11-17 16:15                             ` Gerardo Moro
  0 siblings, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2020-11-17 15:59 UTC (permalink / raw)
  To: Gerardo Moro; +Cc: emacs-orgmode

> Now I get the error: "wrong number of arguments..." :D

It does not happen in my Emacs. It would be helpful if you shared the
whole error message.

I used the following code for testing:

(defun my/org-archive-without-delete ()
  "Archive item at point, but do not actually delete it."
  (cl-letf (((symbol-function 'org-cut-subtree) (lambda () nil)))
    (org-archive-subtree)))
    
(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-archive-repeated-task)

Best,
Ihor

Gerardo Moro <gerardomoro37@gmail.com> writes:

> Now I get the error: "wrong number of arguments..." :D
>
> El mar., 17 nov. 2020 a las 15:13, Ihor Radchenko (<yantar92@gmail.com>)
> escribió:
>
>> > I tried this but I get: "symbol's function definition is void:
>> >  org-trigger-doing"
>>
>> Oops. That's the old function name. Should be
>>
>> (add-hook 'org-trigger-hook #'org-archive-repeated-task)
>>
>> Best,
>> Ihor
>>
>>
>> Gerardo Moro <gerardomoro37@gmail.com> writes:
>>
>> > 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
>> >>
>>


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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-11-17 15:59                           ` Ihor Radchenko
@ 2020-11-17 16:15                             ` Gerardo Moro
  2020-11-18  5:36                               ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Gerardo Moro @ 2020-11-17 16:15 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

Thank you! Ok, now it works. I had to restart my Emacs, probably that was
the problem.

So from now on, all the DONE tasks would be archived straight away on the
day they are DONE. What about the previously LOGGED tasks?
Is there a way to do the same with all the logged items under the :LOGBOOK:
that have been DONE before?

I have thousands of such instances, and I wonder if a function would find
all those items inside the LOGBOOKS and archive them individually under
their own DONE date in the org archive file. Maybe too much to ask! :)
GM


El mar., 17 nov. 2020 a las 18:00, Ihor Radchenko (<yantar92@gmail.com>)
escribió:

> > Now I get the error: "wrong number of arguments..." :D
>
> It does not happen in my Emacs. It would be helpful if you shared the
> whole error message.
>
> I used the following code for testing:
>
> (defun my/org-archive-without-delete ()
>   "Archive item at point, but do not actually delete it."
>   (cl-letf (((symbol-function 'org-cut-subtree) (lambda () nil)))
>     (org-archive-subtree)))
>
> (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-archive-repeated-task)
>
> Best,
> Ihor
>
> Gerardo Moro <gerardomoro37@gmail.com> writes:
>
> > Now I get the error: "wrong number of arguments..." :D
> >
> > El mar., 17 nov. 2020 a las 15:13, Ihor Radchenko (<yantar92@gmail.com>)
> > escribió:
> >
> >> > I tried this but I get: "symbol's function definition is void:
> >> >  org-trigger-doing"
> >>
> >> Oops. That's the old function name. Should be
> >>
> >> (add-hook 'org-trigger-hook #'org-archive-repeated-task)
> >>
> >> Best,
> >> Ihor
> >>
> >>
> >> Gerardo Moro <gerardomoro37@gmail.com> writes:
> >>
> >> > 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
> >> >>
> >>
>

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

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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-11-17 16:15                             ` Gerardo Moro
@ 2020-11-18  5:36                               ` Ihor Radchenko
  2020-11-18  8:35                                 ` Gerardo Moro
  0 siblings, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2020-11-18  5:36 UTC (permalink / raw)
  To: Gerardo Moro; +Cc: emacs-orgmode

> So from now on, all the DONE tasks would be archived straight away on the
> day they are DONE.

Not all the tasks, but all the tasks with repeater.

> Is there a way to do the same with all the logged items under the :LOGBOOK:
> that have been DONE before?

It is certainly possible, but require more complicated function.

Best,
Ihor

Gerardo Moro <gerardomoro37@gmail.com> writes:

> Thank you! Ok, now it works. I had to restart my Emacs, probably that was
> the problem.
>
> So from now on, all the DONE tasks would be archived straight away on the
> day they are DONE. What about the previously LOGGED tasks?
> Is there a way to do the same with all the logged items under the :LOGBOOK:
> that have been DONE before?
>
> I have thousands of such instances, and I wonder if a function would find
> all those items inside the LOGBOOKS and archive them individually under
> their own DONE date in the org archive file. Maybe too much to ask! :)
> GM
>
>
> El mar., 17 nov. 2020 a las 18:00, Ihor Radchenko (<yantar92@gmail.com>)
> escribió:
>
>> > Now I get the error: "wrong number of arguments..." :D
>>
>> It does not happen in my Emacs. It would be helpful if you shared the
>> whole error message.
>>
>> I used the following code for testing:
>>
>> (defun my/org-archive-without-delete ()
>>   "Archive item at point, but do not actually delete it."
>>   (cl-letf (((symbol-function 'org-cut-subtree) (lambda () nil)))
>>     (org-archive-subtree)))
>>
>> (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-archive-repeated-task)
>>
>> Best,
>> Ihor
>>
>> Gerardo Moro <gerardomoro37@gmail.com> writes:
>>
>> > Now I get the error: "wrong number of arguments..." :D
>> >
>> > El mar., 17 nov. 2020 a las 15:13, Ihor Radchenko (<yantar92@gmail.com>)
>> > escribió:
>> >
>> >> > I tried this but I get: "symbol's function definition is void:
>> >> >  org-trigger-doing"
>> >>
>> >> Oops. That's the old function name. Should be
>> >>
>> >> (add-hook 'org-trigger-hook #'org-archive-repeated-task)
>> >>
>> >> Best,
>> >> Ihor
>> >>
>> >>
>> >> Gerardo Moro <gerardomoro37@gmail.com> writes:
>> >>
>> >> > 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
>> >> >>
>> >>
>>


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

* Re: Archiving repeated tasks under corresponding date tree for each repeated item
  2020-11-18  5:36                               ` Ihor Radchenko
@ 2020-11-18  8:35                                 ` Gerardo Moro
  0 siblings, 0 replies; 18+ messages in thread
From: Gerardo Moro @ 2020-11-18  8:35 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

Indeed. I will try to work on it in my spare time, it will take maybe up to
a year, but as soon as I have it, I will let the maillist know in case it's
of interest.
Again, thanks for all your help.
GM

El mié., 18 nov. 2020 a las 7:37, Ihor Radchenko (<yantar92@gmail.com>)
escribió:

> > So from now on, all the DONE tasks would be archived straight away on the
> > day they are DONE.
>
> Not all the tasks, but all the tasks with repeater.
>
> > Is there a way to do the same with all the logged items under the
> :LOGBOOK:
> > that have been DONE before?
>
> It is certainly possible, but require more complicated function.
>
> Best,
> Ihor
>
> Gerardo Moro <gerardomoro37@gmail.com> writes:
>
> > Thank you! Ok, now it works. I had to restart my Emacs, probably that was
> > the problem.
> >
> > So from now on, all the DONE tasks would be archived straight away on the
> > day they are DONE. What about the previously LOGGED tasks?
> > Is there a way to do the same with all the logged items under the
> :LOGBOOK:
> > that have been DONE before?
> >
> > I have thousands of such instances, and I wonder if a function would find
> > all those items inside the LOGBOOKS and archive them individually under
> > their own DONE date in the org archive file. Maybe too much to ask! :)
> > GM
> >
> >
> > El mar., 17 nov. 2020 a las 18:00, Ihor Radchenko (<yantar92@gmail.com>)
> > escribió:
> >
> >> > Now I get the error: "wrong number of arguments..." :D
> >>
> >> It does not happen in my Emacs. It would be helpful if you shared the
> >> whole error message.
> >>
> >> I used the following code for testing:
> >>
> >> (defun my/org-archive-without-delete ()
> >>   "Archive item at point, but do not actually delete it."
> >>   (cl-letf (((symbol-function 'org-cut-subtree) (lambda () nil)))
> >>     (org-archive-subtree)))
> >>
> >> (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-archive-repeated-task)
> >>
> >> Best,
> >> Ihor
> >>
> >> Gerardo Moro <gerardomoro37@gmail.com> writes:
> >>
> >> > Now I get the error: "wrong number of arguments..." :D
> >> >
> >> > El mar., 17 nov. 2020 a las 15:13, Ihor Radchenko (<
> yantar92@gmail.com>)
> >> > escribió:
> >> >
> >> >> > I tried this but I get: "symbol's function definition is void:
> >> >> >  org-trigger-doing"
> >> >>
> >> >> Oops. That's the old function name. Should be
> >> >>
> >> >> (add-hook 'org-trigger-hook #'org-archive-repeated-task)
> >> >>
> >> >> Best,
> >> >> Ihor
> >> >>
> >> >>
> >> >> Gerardo Moro <gerardomoro37@gmail.com> writes:
> >> >>
> >> >> > 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
> >> >> >>
> >> >>
> >>
>

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

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

end of thread, other threads:[~2020-11-18  8:48 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAF4Fj9hjjQ98gGe7hRp0tU4qPtZ-ekUUpO9niNpJ+s31g2buOA@mail.gmail.com>
2020-10-24  4:06 ` Archiving repeated tasks under corresponding date tree for each repeated item Gerardo Moro
2020-10-29  7:01   ` Gerardo Moro
2020-11-02 14:18     ` Julius Dittmar
2020-11-03  5:52     ` Ihor Radchenko
2020-11-12  7:59       ` Gerardo Moro
2020-11-12 10:27         ` Ihor Radchenko
2020-11-16 15:21           ` Gerardo Moro
2020-11-17  8:58             ` Gerardo Moro
2020-11-17  9:31               ` Ihor Radchenko
2020-11-17 12:00                 ` Gerardo Moro
2020-11-17 12:31                   ` Ihor Radchenko
2020-11-17 12:57                     ` Gerardo Moro
2020-11-17 13:12                       ` Ihor Radchenko
2020-11-17 15:35                         ` Gerardo Moro
2020-11-17 15:59                           ` Ihor Radchenko
2020-11-17 16:15                             ` Gerardo Moro
2020-11-18  5:36                               ` Ihor Radchenko
2020-11-18  8:35                                 ` Gerardo Moro

unofficial mirror of emacs-orgmode@gnu.org

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/orgmode/0 orgmode/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 orgmode orgmode/ https://yhetil.org/orgmode \
		emacs-orgmode@gnu.org
	public-inbox-index orgmode

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git