emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Marco Wahl <marcowahlsoft@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: mark as done on a previous date?
Date: Fri, 30 Dec 2016 13:14:52 +0100	[thread overview]
Message-ID: <84eg0p7gw3.fsf@gmail.com> (raw)
In-Reply-To: m2inq2c20w.fsf@Margil.home

Hi!

> 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.
> [...]

I did not check why the other functions fail.

What about the following function?  I'm on Org 9.

#v+
(defun mw-org-todo-with-other-date (date &optional arg)
  "Like `org-todo' but ask for a specific DATE.
Optional argument ARG prefix arg."
  (interactive (list (org-read-date) current-prefix-arg))
  (let* ((org-use-effective-time t)
         (hour
          (truncate
           (- (/ (org-time-stamp-to-now date t)
                 60 60))))
          (org-extend-today-until (1+ hour)))
    (org-todo arg)))
#v-

This function has been inspired by Org's `org-todo-yesterday'.  The
latter even does its job when triggered from the agenda.


HTH
                       Marco

  reply	other threads:[~2016-12-30 12:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-29 13:12 mark as done on a previous date? Stig Brautaset
2016-12-30 12:14 ` Marco Wahl [this message]
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=84eg0p7gw3.fsf@gmail.com \
    --to=marcowahlsoft@gmail.com \
    --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).