From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stig Brautaset Subject: mark as done on a previous date? Date: Thu, 29 Dec 2016 13:12:31 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMaVe-0004lq-MH for emacs-orgmode@gnu.org; Thu, 29 Dec 2016 08:12:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cMaVZ-0001Ui-IO for emacs-orgmode@gnu.org; Thu, 29 Dec 2016 08:12:42 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:60376) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cMaVZ-0001UJ-BK for emacs-orgmode@gnu.org; Thu, 29 Dec 2016 08:12:37 -0500 Received: from mfilter11-d.gandi.net (mfilter11-d.gandi.net [217.70.178.131]) by relay6-d.mail.gandi.net (Postfix) with ESMTP id 69741FB88B for ; Thu, 29 Dec 2016 14:12:35 +0100 (CET) Received: from relay6-d.mail.gandi.net ([IPv6:::ffff:217.70.183.198]) by mfilter11-d.gandi.net (mfilter11-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id LW__pV-iukG0 for ; Thu, 29 Dec 2016 14:12:32 +0100 (CET) Received: from localhost (host81-131-118-55.range81-131.btcentralplus.com [81.131.118.55]) (Authenticated sender: mailbox@brautaset.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id B3E2CFB8B3 for ; Thu, 29 Dec 2016 14:12:32 +0100 (CET) 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: Orgmode Mailing List I'm trying to use org-habit to track my habits and sometimes I don't get around to mark stuff as done on the day I do them. I've found two different functions for marking stuff as done in the past, but I can't get either of them to work. Here are the two different approaches I found. The first was at https://www.emacswiki.org/emacs/OrgMode#toc22 and is the most general: #+BEGIN_SRC emacs-lisp (defun org-todo-at-date (date) (interactive (list (org-time-string-to-time (org-read-date)))) (cl-flet ((org-current-effective-time (&rest r) date) (org-today (&rest r) (time-to-days date))) (org-todo))) #+END_SRC The second is from https://joelmccracken.github.io/entries/emacs-hack-set-todo-done-yesterday/ and looks like this: #+BEGIN_SRC emacs-lisp (defun org-todo-toggle-yesterday () (interactive) (let ((time-in-question (decode-time))) (decf (nth 3 time-in-question)) (setq time-in-question (apply 'encode-time time-in-question)) (flet ((current-time () time-in-question)) (org-todo)))) #+END_SRC Unfortunately, I haven't been able to get either to work. I've tested with Org 9, and with =emacs -Q= (which gives me Org 8.2) but can't get it to work in either. Perhaps the tricks employed do not work in Emacs 25? FWIW: : GNU Emacs 25.1.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911)) of 2016-09-21 : Org mode version 9.0.3 (9.0.3-elpaplus @ /Users/stig/.emacs.d/elpa/org-plus-contrib-20161224/) Stig