From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kyle Meyer Subject: Re: How to mark task as done at specified (past) time? Date: Thu, 12 Dec 2019 03:26:55 +0000 Message-ID: <877e32ql4w.fsf@kyleam.com> References: <875zj42rpx.fsf@passepartout.tim-landscheidt.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:41847) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifF84-0001tX-QT for emacs-orgmode@gnu.org; Wed, 11 Dec 2019 22:27:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifF82-0000ly-OA for emacs-orgmode@gnu.org; Wed, 11 Dec 2019 22:27:04 -0500 Received: from pb-smtp20.pobox.com ([173.228.157.52]:55648) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifF81-0000hF-UY for emacs-orgmode@gnu.org; Wed, 11 Dec 2019 22:27:02 -0500 In-Reply-To: <875zj42rpx.fsf@passepartout.tim-landscheidt.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Tim Landscheidt , emacs-orgmode@gnu.org Tim Landscheidt writes: [...] > I want Gnus to mark the task as done /at the time when the mail was > sent/, i. e. in: > | - State "DONE" from "TODO" [2019-11-27 Mi 16:44] > > I want "2019-11-27 Mi 16:44" not to be the current time, but > some other (past) time. > > How can I mark a task as done at a specified time? Looking > at org-add-planning-info, there seems to be a mechanism to > pass a timestamp, but it does not seem to be exposed at > higher levels (?). Yes, as far as I can see, org-todo uses the TIME argument of org-add-planning-info for the org-extend-today-until feature, but there's not a way for the caller to directly specify the timestamp. > 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)))