emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Brady Trainor <algebrat@uw.edu>
To: Grant Schissler <grant.schissler@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Customize org-todo-repeat-to-state to return to previous TODO state
Date: Fri, 21 Nov 2014 12:56:02 -0800	[thread overview]
Message-ID: <87oas0z319.fsf@uw.edu> (raw)
In-Reply-To: <loom.20141121T185239-72@post.gmane.org> (Grant Schissler's message of "Fri, 21 Nov 2014 18:00:15 +0000 (UTC)")

Grant Schissler <grant.schissler@gmail.com> writes:

> Hi Org-mode Users,
>
> I am trying to change the behavior of marking a repeated task as DONE.  I 
> would like the task to return to the current TODO state rather than the first in 
> the TODO sequence or a fixed state.  For example,
>
> ** APPT Lunch with Mallorie
> <2014-12-04 Thu 12:00 +1w>
>
> should return to APPT, not TODO or some other predefined state as in the 
> current behavior:
>
> TODO Lunch with Mallorie
> - State "DONE"       from "APPT"       [2014-11-21 Fri 10:56]
> <2014-12-11 Thu 12:00 +1w>
>
> I am sure that customizing the org-todo-repeat-to-state will do the trick, but 
> sadly, I have had the time to learn elisp well enough to perform this.
>
> Any help would be much appreciated.  Please let me know if you have 
> questions.
>
> Thanks for the support and to all those that make org-mode great!
> Grant

I haven't tried any of the following, and there may be better solutions, but...

It looks like the variable you mention reads as (via C-h v org-todo-repeat-to-state RET and follow link to source), 

#+BEGIN_SRC emacs-lisp
(defcustom org-todo-repeat-to-state nil
  "The TODO state to which a repeater should return the repeating task.
By default this is the first task in a TODO sequence, or the previous state
in a TODO_TYP set.  But you can specify another task here.
alternatively, set the :REPEAT_TO_STATE: property of the entry."
  :group 'org-todo
  :version "24.1"
  :type '(choice (const :tag "Head of sequence" nil)
		 (string :tag "Specific state")))

#+END_SRC

It looks like this variable will not allow to recall the previous TODO state. But you could make a separate TODO_TYP set.

Depending on whether you define your TODO states in an init file or per-file base, you could try an extra line in your org file "header",

#+BEGIN_SRC org
,#+TYP_TODO: APPT | DONE
#+END_SRC

or an extra block in your org-todo-keywords variable

#+BEGIN_SRC emacs-lisp
(setq org-todo-keywords '((type "APPT" "|" "DONE")))
#+END_SRC

Another solution according to the above would be to use a property drawer, 

#+BEGIN_SRC org
,** APPT Lunch with Mallorie
<2014-12-04 Thu 12:00 +1w>
:PROPERTIES:
:REPEAT_TO_STATE: APPT
:END:
#+END_SRC

You can get this via C-c C-x p repeat_to_state RET APPT RET.

Interestingly, there is a function in the same source file, org-auto-repeat-maybe, which suggests that it does exactly what you ask for. 

#+BEGIN_EXAMPLE
org-auto-repeat-maybe is a compiled Lisp function in `org.el'.

(org-auto-repeat-maybe DONE-WORD)

Check if the current headline contains a repeated deadline/schedule.
If yes, set TODO state back to what it was and change the base date
of repeating deadline/scheduled time stamps to new date.
This function is run automatically after each state change to a DONE state.

[back]
#+END_EXAMPLE

I can see in the definition of the function it has an expression org-last-state, so maybe that suggests there is a way built-in (or intended to?), but I only took that quick look at the source. 

--
Brady

  reply	other threads:[~2014-11-21 20:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21 18:00 Customize org-todo-repeat-to-state to return to previous TODO state Grant Schissler
2014-11-21 20:56 ` Brady Trainor [this message]
2014-11-25  5:10   ` Grant Schissler

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=87oas0z319.fsf@uw.edu \
    --to=algebrat@uw.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=grant.schissler@gmail.com \
    /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).