emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* mark as done on a previous date?
@ 2016-12-29 13:12 Stig Brautaset
  2016-12-30 12:14 ` Marco Wahl
  0 siblings, 1 reply; 4+ messages in thread
From: Stig Brautaset @ 2016-12-29 13:12 UTC (permalink / raw)
  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-04 17:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-29 13:12 mark as done on a previous date? Stig Brautaset
2016-12-30 12:14 ` Marco Wahl
2016-12-30 16:38   ` Stig Brautaset
2017-01-04 17:40     ` Marco Wahl

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).