From: Gerardo Moro <gerardomoro37@gmail.com>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Archiving repeated tasks under corresponding date tree for each repeated item
Date: Wed, 18 Nov 2020 10:35:25 +0200 [thread overview]
Message-ID: <CAF4Fj9hbEUPS2hwKBUJUriubv2kakBjy-=2o7r7zs2pNoyfHtA@mail.gmail.com> (raw)
In-Reply-To: <87y2izmdks.fsf@localhost>
[-- 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 --]
prev parent reply other threads:[~2020-11-18 8:48 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 ` 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 [this message]
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='CAF4Fj9hbEUPS2hwKBUJUriubv2kakBjy-=2o7r7zs2pNoyfHtA@mail.gmail.com' \
--to=gerardomoro37@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@gmail.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).