From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id WMT+KkGztF8jHgAA0tVLHw (envelope-from ) for ; Wed, 18 Nov 2020 05:38:09 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id QKRoJkGztF/HLQAAB5/wlQ (envelope-from ) for ; Wed, 18 Nov 2020 05:38:09 +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 0C1D994006E for ; Wed, 18 Nov 2020 05:38:08 +0000 (UTC) Received: from localhost ([::1]:40350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kfGAQ-0007kS-Cs for larch@yhetil.org; Wed, 18 Nov 2020 00:38:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfG9b-0007k0-7S for emacs-orgmode@gnu.org; Wed, 18 Nov 2020 00:37:16 -0500 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:43314) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kfG9W-0007oQ-P2 for emacs-orgmode@gnu.org; Wed, 18 Nov 2020 00:37:14 -0500 Received: by mail-pg1-x52a.google.com with SMTP id 34so404671pgp.10 for ; Tue, 17 Nov 2020 21:37:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=ZxR7l1kh8wlanI0Cj02+igiQ0sdNOe91gxLttGurwz8=; b=SAd3SgJ1WfcqRsrBwDUawRuBF/nVl8ur4QKyDX4lxYtFjQoOr3y+smqn+uEVss7v6t kxboexYhn7FdU0cdGVDgeHpC75wZoWtEIKfiwOKTbQuVU2tvigyTn47PMtKRRI/DHT2b ZgJfunmE+NWf7fDPjwNCJgilyo9nEw0LYfil70x3Gc5l33VKXcsTKy9UTM1mzxJmWCQ+ 8mxfqYDlE9OP0wzxt1iXBPdYbO8sFmOXEIAH3oYWFbZmCPdrqChdypcu1+CNjXJV6K9N 9eMFQgBMuD/beLCNneDVAekZR5HIXL24mKbzqG3uDSUq+56UiwJdpS7JzIT7/1KzjUdr cSZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=ZxR7l1kh8wlanI0Cj02+igiQ0sdNOe91gxLttGurwz8=; b=cGBvB737zCvq/85vzU464kf9MTRM6Vc5lV4ZlAfCtIm1CJERDm81ZPQ0gj6mtWIIIS cvsf333Je+OGkd9puulO5QrBMT9gELCu2yrl5pzvRiTEwYUUwv4peuxupGAUE0vsgMRD z3x9WuFd40ue+uPesGmFcP9/ZWMOxr21WVPMu52vaIQwcY0Dc1Kobf2yNYpZSmFaC9aM nxPTbrAbAFShLuJcIRte6ddt1oiiR8VMJH1pEZTahjnPFWquj9eKBbBpcmgOxzYL0fyl 09YfH0nxmIxTPcklHVEGxDEtnwwCnqEGAJBaVl2L0cocHzR2JiF1FYBcdX2bmph93fsX R7mg== X-Gm-Message-State: AOAM530G6cEHU5tUII3J9+YQp6Z3iUk4fGR3/Gl0Fdrb08B0SysmTgUT IbCdM2BgAs5xd7gp+SRzd5s= X-Google-Smtp-Source: ABdhPJyYUNqgaKocpznz8xrD60pMxDSqkfGgxpIq90KFrFz1t19QKbBePG8CWBbS1PRm2qR87wSCFQ== X-Received: by 2002:a62:62c7:0:b029:18b:c7ae:934a with SMTP id w190-20020a6262c70000b029018bc7ae934amr2849732pfb.18.1605677828180; Tue, 17 Nov 2020 21:37:08 -0800 (PST) Received: from localhost ([107.155.105.218]) by smtp.gmail.com with ESMTPSA id d11sm25447494pfq.99.2020.11.17.21.37.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 21:37:06 -0800 (PST) From: Ihor Radchenko To: Gerardo Moro Subject: Re: Archiving repeated tasks under corresponding date tree for each repeated item In-Reply-To: References: <87lffj7zss.fsf@localhost> <87zh3mlvj7.fsf@localhost> <87ft58nxck.fsf@localhost> <87d00cnp0i.fsf@localhost> <87a6vgnn4q.fsf@localhost> <874klonfdi.fsf@localhost> Date: Wed, 18 Nov 2020 13:36:03 +0800 Message-ID: <87y2izmdks.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=yantar92@gmail.com; helo=mail-pg1-x52a.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, 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=SAd3SgJ1; 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.21 X-TUID: Q2Al4T71PYOg > 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 :LOGBOO= K: > that have been DONE before? It is certainly possible, but require more complicated function. Best, Ihor Gerardo Moro 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 :LOGBOO= K: > 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 () > escribi=C3=B3: > >> > 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=3D (plist-get arg :to) "DONE")) ;; The state is cha= nged >> 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 writes: >> >> > Now I get the error: "wrong number of arguments..." :D >> > >> > El mar., 17 nov. 2020 a las 15:13, Ihor Radchenko () >> > escribi=C3=B3: >> > >> >> > 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 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=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 >> >> 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=3D (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 >> >> >> >> >> >>