emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Gerardo Moro <gerardomoro37@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Archiving repeated tasks under corresponding date tree for each repeated item
Date: Thu, 12 Nov 2020 18:27:40 +0800	[thread overview]
Message-ID: <87zh3mlvj7.fsf@localhost> (raw)
In-Reply-To: <CAF4Fj9gCrav29=RY2NoBRm97KpjADg1EB07uHwWK+baf21ybiQ@mail.gmail.com>

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


  reply	other threads:[~2020-11-12 10:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAF4Fj9hjjQ98gGe7hRp0tU4qPtZ-ekUUpO9niNpJ+s31g2buOA@mail.gmail.com>
2020-10-24  4:06 ` 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zh3mlvj7.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=gerardomoro37@gmail.com \
    --subject='Re: Archiving repeated tasks under corresponding date tree for each repeated item' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this 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).