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 MAf6CrMxBl8GbwAA0tVLHw (envelope-from ) for ; Wed, 08 Jul 2020 20:50:59 +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 SLnKBrMxBl+vcgAAB5/wlQ (envelope-from ) for ; Wed, 08 Jul 2020 20:50:59 +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 841DA94071A for ; Wed, 8 Jul 2020 20:50:58 +0000 (UTC) Received: from localhost ([::1]:35172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtH1t-0005MP-0H for larch@yhetil.org; Wed, 08 Jul 2020 16:50:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtH16-0005MC-KM for emacs-orgmode@gnu.org; Wed, 08 Jul 2020 16:50:08 -0400 Received: from andalucia.tim-landscheidt.de ([116.203.78.250]:50510) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtH14-0005Sm-IB for emacs-orgmode@gnu.org; Wed, 08 Jul 2020 16:50:08 -0400 Received: from dslb-090-186-010-106.090.186.pools.vodafone-ip.de ([90.186.10.106]:60282 helo=passepartout.tim-landscheidt.de) by andalucia.tim-landscheidt.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1jtH0y-0000Kf-IY; Wed, 08 Jul 2020 22:50:00 +0200 From: Tim Landscheidt To: Kyle Meyer Subject: Re: How to mark task as done at specified (past) time? Organization: http://www.tim-landscheidt.de/ References: <875zj42rpx.fsf@passepartout.tim-landscheidt.de> <877e32ql4w.fsf@kyleam.com> Date: Wed, 08 Jul 2020 20:50:00 +0000 In-Reply-To: <877e32ql4w.fsf@kyleam.com> (Kyle Meyer's message of "Thu, 12 Dec 2019 03:26:55 +0000") Message-ID: <87366168av.fsf@passepartout.tim-landscheidt.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=116.203.78.250; envelope-from=tim@tim-landscheidt.de; helo=andalucia.tim-landscheidt.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/08 16:50:03 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; 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: -0.01 X-TUID: MjL9fcaKskeE Kyle Meyer wrote a long time ago: > [=E2=80=A6] >> Do I have to cl-flet org-current-time or something similar? > Something along those lines would probably be the most straightforward. > Light testing with the command below suggests overriding current-time is > sufficient: > (defun my-org-todo-time-machine () > (interactive) > (cl-letf (((symbol-function 'current-time) > (lambda () > (apply #'encode-time (org-parse-time-string > "2019-11-27 Mi 16:44"))))) > (call-interactively #'org-todo))) I finally got around to this and ended up with an entry in gnus-select-article-hook =C3=A0 la: | (lambda nil | (if | (and | (string=3D gnus-newsgroup-name "mail.only.this.group") | (string-match "^Regular expression that matches subject$" | (gnus-summary-article-subject))) | (let | ((article-time | (gnus-date-get-time | (mail-header-date | (gnus-summary-article-header))))) | (cl-letf | (((symbol-function 'current-time) | (lambda nil article-time))) | (find-file "/path/to/file.org") | (goto-char | (org-find-entry-with-id "TASK-ID")) | (org-todo 'done))))) I have an icky feeling about cl-letfing current-time because Murphy might cause a timer to fire in just that time frame and I have no idea what current-time is for that timer; so if future org-mode releases would provide a cleaner API I would very much appreciate that :-). Thanks, Tim