From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id cN2nMsXIs1/MYgAA0tVLHw (envelope-from ) for ; Tue, 17 Nov 2020 12:57:41 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id KAtnLsXIs1/7FAAA1q6Kng (envelope-from ) for ; Tue, 17 Nov 2020 12:57:41 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id ECBD79402B0 for ; Tue, 17 Nov 2020 12:57:40 +0000 (UTC) Received: from localhost ([::1]:46666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kf0YE-00065K-9k for larch@yhetil.org; Tue, 17 Nov 2020 07:57:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kf0Xr-00065B-7D for emacs-orgmode@gnu.org; Tue, 17 Nov 2020 07:57:15 -0500 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]:42677) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kf0Xp-000821-94 for emacs-orgmode@gnu.org; Tue, 17 Nov 2020 07:57:14 -0500 Received: by mail-lf1-x130.google.com with SMTP id u18so29905005lfd.9 for ; Tue, 17 Nov 2020 04:57:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RjFejYQHtLnz7FyWWVjIBZmTZATxCLeS/9lc4A9xbtM=; b=YYupiK9//O7cNfS2XmolTsHtVef61fd9NVCBqN0Lb7S/uUi39YECRZD/NQj88YcRDD V2+KGctNBrCjXa2tgmDN6HT+cPGtDGYPMHOTP0Url0CXalqpEHxs9Wvo/3V/fLvfwnVo Cq7bKwLRFt5MwRBDrOSZOErZ3sxWXYU9G3X/SMLT/b645ZTJMOrTyzQOQQigTBVwFda1 MeBiG6mFOGrBMznzEW2TmjKqZ8aiipRVukWB61qGzYwAZHNV09rvMR8nFkuJix0m+BEb 8Dg9hK8EvX5CvkbUhFn+eGDyl2K+8Zn5D57tGVGjbmPH7aPSa5cm4BhROecASEYJBLvL wSbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RjFejYQHtLnz7FyWWVjIBZmTZATxCLeS/9lc4A9xbtM=; b=VPe0xgy/9Am4JwQrzuvKubssu1SuQywMJq0T/TGua1fAs0mKjrPhANaUFjajlMkOOt 6lNQGo1pjHCh5z37XQutOUKXCyYHufYLpCNWrMLsp45ZTVCiPuAKoo7d+NIMncg7DIIZ 71wgs+wM0V0R03xvnjU9ICxAQHpwpfQ3mrPX7YPwB6Cn4lzaP5Hj/hUrHOuEwhw6R9O9 77QFJxUSg2vfb0bSxmRdZ4/+C2rJYUVrCHrL58aLTG8xLppD1s6Ubk4+r4WaSPGrzkFz yY2SEPBkEwKWO4WGoHQnKK2psroB7d6/amIfmDJeNfFao5hpphofb00fDc3eNTfQCnDH 8oCQ== X-Gm-Message-State: AOAM530D2l0U5xsGbNlOWxlZO82emM2mNipAspz0yH0WnLr2pGoScl6S UBW3b0PSxPM5UqNI95DgUHul0RR/pqDCSMmaSdM= X-Google-Smtp-Source: ABdhPJwb7i/t/12XeyJV5nzKLAJjc2ZPWyL2ypSEqGg6jxw0pdYxx4ZfOOy4H/kxb0pO7kWGhWys4Kimo19kIsNFUXs= X-Received: by 2002:a05:6512:308e:: with SMTP id z14mr1597172lfd.152.1605617831493; Tue, 17 Nov 2020 04:57:11 -0800 (PST) MIME-Version: 1.0 References: <87lffj7zss.fsf@localhost> <87zh3mlvj7.fsf@localhost> <87ft58nxck.fsf@localhost> <87d00cnp0i.fsf@localhost> In-Reply-To: <87d00cnp0i.fsf@localhost> From: Gerardo Moro Date: Tue, 17 Nov 2020 14:57:00 +0200 Message-ID: Subject: Re: Archiving repeated tasks under corresponding date tree for each repeated item To: Ihor Radchenko Content-Type: multipart/alternative; boundary="0000000000007dc5ef05b44d0804" Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=gerardomoro37@gmail.com; helo=mail-lf1-x130.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=YYupiK9/; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.71 X-TUID: /KwkUcFtwOvN --0000000000007dc5ef05b44d0804 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 () escribi=C3=B3: > > Thanks, I don't know how to go about doing that, so I would have to rel= y > on > > others wanting to help me if they consider this to be also useful to th= em > > (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=3D (plist-get arg :to) "DONE")) ;; The state is chan= ged > 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 writes: > > > Thanks, I don't know how to go about doing that, so I would have to rel= y > on > > others wanting to help me if they consider this to be also useful to th= em > > (which I definitely think it is!). > > > > El mar., 17 nov. 2020 a las 11:32, Ihor Radchenko (= ) > > escribi=C3=B3: > > > >> > 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 yo= u > >> mark the task DONE. > >> > >> Best, > >> Ihor > >> > >> Gerardo Moro 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=C3=B3: > >> > > >> > --0000000000007dc5ef05b44d0804 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks for the prompt reply!
I tried this but I get: &= quot;symbol's function definition is void: =C2=A0org-trigger-doing"= ;

El mar., 17 nov. 2020 a las 14:32, Ihor Radchenko (<yantar92@gmail.com>) escribi=C3=B3:
> 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 t= hem
> (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)
=C2=A0 "Add a copy of the recurring task marked DONE to archive."=
=C2=A0 (when (and (eq (plist-get arg :type) 'todo-state-change)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(string=3D (plist-get arg := to) "DONE")) ;; The state is changed to DONE
=C2=A0 =C2=A0 (let* ((pos (plist-get arg :position))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(repeater (org-with-point-at pos (= org-get-repeat))))
=C2=A0 =C2=A0 =C2=A0 (when repeater ;; Only consider tasks with repeater ti= mestamp anywhere in the task body
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (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 t= o rely on
> others wanting to help me if they consider this to be also useful to t= hem
> (which I definitely think it is!).
>
> El mar., 17 nov. 2020 a las 11:32, Ihor Radchenko (<yantar92@gmail.com>)
> escribi=C3=B3:
>
>> > I actually now realized that your function will not unfortuna= tely archive
>> > each logged item (those located in the logbook) in its corres= ponding 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 suggeste= d to run
>> it in org-trigger-hook, which will trigger at the day and time whe= n you
>> mark the task DONE.
>>
>> Best,
>> Ihor
>>
>> Gerardo Moro <gerardomoro37@gmail.com> writes:
>>
>> > Hi again,
>> >
>> > I actually now realized that your function will not unfortuna= tely archive
>> > each logged item (those located in the logbook) in its corres= ponding 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
>> >=C2=A0 =C2=A0SCHEDULED: <2020-11-30 Mon +20d>
>> >=C2=A0 =C2=A0:PROPERTIES:
>> >=C2=A0 =C2=A0:STYLE:=C2=A0 =C2=A0 habit
>> >=C2=A0 =C2=A0:LAST_REPEAT: [2020-11-09 Mon 22:28]
>> >=C2=A0 =C2=A0:END:
>> > :LOGBOOK:
>> > - State "DONE"=C2=A0 =C2=A0 =C2=A0 =C2=A0from "= ;TODO"=C2=A0 =C2=A0 =C2=A0 =C2=A0[2020-11-15 Sun 22:28]
>> > - State "DONE"=C2=A0 =C2=A0 =C2=A0 =C2=A0from "= ;STARTED"=C2=A0 =C2=A0 [2020-11-14 Sat 22:17]
>> > - State "DONE"=C2=A0 =C2=A0 =C2=A0 =C2=A0from "= ;STARTED"=C2=A0 =C2=A0 [2020-11-13 Fri 22:17]
>> > - State "DONE"=C2=A0 =C2=A0 =C2=A0 =C2=A0from "= ;STARTED"=C2=A0 =C2=A0 [2020-11-11 Wed 22:17]
>> >
>> > If I position myself in any point in this entry, when I execu= te the
>> > function it will archive the whole tree+subtree under today&#= 39;s date (the
>> > date when it was archived).
>> > The behaviour I was expecting is to archive each of the logge= d 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 (<
>> gerar= domoro37@gmail.com>)
>> > escribi=C3=B3:
>> >
>>
--0000000000007dc5ef05b44d0804--