emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Stig Brautaset <stig@brautaset.org>
To: Orgmode Mailing List <emacs-orgmode@gnu.org>
Subject: mark as done on a previous date?
Date: Thu, 29 Dec 2016 13:12:31 +0000	[thread overview]
Message-ID: <m2inq2c20w.fsf@Margil.home> (raw)


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

             reply	other threads:[~2016-12-29 13:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-29 13:12 Stig Brautaset [this message]
2016-12-30 12:14 ` mark as done on a previous date? Marco Wahl
2016-12-30 16:38   ` Stig Brautaset
2017-01-04 17:40     ` Marco Wahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2inq2c20w.fsf@Margil.home \
    --to=stig@brautaset.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).