summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-04-12 12:02:12 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2010-04-12 12:02:56 +0200
commit32340d03899f1daa8b8a63bf2bed2ec0f6de7705 (patch)
treec89895e27402eea073bc24b85f5741d7248d12b0
parent82364dafb8e8fba0fd8f7387c21df9513dbc91e7 (diff)
downloadorg-mode-32340d03899f1daa8b8a63bf2bed2ec0f6de7705.tar.gz
Make the repeater target state configurable
The target state can now be fixed locally with the REPEAT_TO_STATE property, or globally with the variable `org-todo-repeat-to-state'. This was a request by John Wiegley.
-rw-r--r--doc/ChangeLog5
-rw-r--r--doc/org.texi26
-rwxr-xr-xlisp/ChangeLog3
-rw-r--r--lisp/org.el19
4 files changed, 39 insertions, 14 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 1951847..8bfab1d 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2010-04-12 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org.texi (Repeated tasks): Document that the user can determine
+ the target state.
+
2010-04-07 Carsten Dominik <carsten.dominik@gmail.com>
* org.texi (LaTeX and PDF export): Add a footnote about xetex.
diff --git a/doc/org.texi b/doc/org.texi
index a2b85d4..af076b7 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -5375,17 +5375,21 @@ from that time. If you need both a repeater and a special warning period in
a deadline entry, the repeater should come first and the warning period last:
@code{DEADLINE: <2005-10-01 Sat +1m -3d>}.
-Deadlines and scheduled items produce entries in the agenda when they
-are over-due, so it is important to be able to mark such an entry as
-completed once you have done so. When you mark a DEADLINE or a SCHEDULE
-with the TODO keyword DONE, it will no longer produce entries in the
-agenda. The problem with this is, however, that then also the
-@emph{next} instance of the repeated entry will not be active. Org mode
-deals with this in the following way: When you try to mark such an entry
-DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
-timestamp by the repeater interval, and immediately set the entry state
-back to TODO. In the example above, setting the state to DONE would
-actually switch the date like this:
+@vindex org-todo-repeat-to-state
+Deadlines and scheduled items produce entries in the agenda when they are
+over-due, so it is important to be able to mark such an entry as completed
+once you have done so. When you mark a DEADLINE or a SCHEDULE with the TODO
+keyword DONE, it will no longer produce entries in the agenda. The problem
+with this is, however, that then also the @emph{next} instance of the
+repeated entry will not be active. Org mode deals with this in the following
+way: When you try to mark such an entry DONE (using @kbd{C-c C-t}), it will
+shift the base date of the repeating timestamp by the repeater interval, and
+immediately set the entry state back to TODO@footnote{In fact, the target
+state is taken from, in this sequence, the @code{REPEAT_TO_STATE} property or
+the variable @code{org-todo-repeat-to-state}. If neither of these is
+specified, the target state defaults to the first state of the TODO state
+sequence.}. In the example above, setting the state to DONE would actually
+switch the date like this:
@example
** TODO Pay the rent
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7594fdc..d8ba822 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -2,6 +2,9 @@
* org.el (org-export-latex-default-packages-alist): Remove
microtype package.
+ (org-todo-repeat-to-state): New variable.
+ (org-auto-repeat-maybe): Allow user-selected target states.
+ (org-default-properties): Add the new property REPEAT_TO_STATE.
2010-04-09 Carsten Dominik <carsten.dominik@gmail.com>
diff --git a/lisp/org.el b/lisp/org.el
index 9a37e1c..7c57edf 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2184,6 +2184,15 @@ When nil, the state change notes will be ordered according to time."
:group 'org-progress
:type 'boolean)
+(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
+ :type '(choice (const :tag "Head of sequence" nil)
+ (string :tag "Specific state")))
+
(defcustom org-log-repeat 'time
"Non-nil means record moving through the DONE state when triggering repeat.
An auto-repeating task is immediately switched back to TODO when
@@ -10835,10 +10844,14 @@ This function is run automatically after each state change to a DONE state."
(org-log-done nil)
(org-todo-log-states nil)
(nshiftmax 10) (nshift 0)
- re type n what ts time)
+ re type n what ts time to-state)
(when repeat
(if (eq org-log-repeat t) (setq org-log-repeat 'state))
- (org-todo (if (eq interpret 'type) last-state head))
+ (setq to-state (or (org-entry-get nil "REPEAT_TO_STATE")
+ org-todo-repeat-to-state))
+ (unless (and to-state (member to-state org-todo-keywords-1))
+ (setq to-state (if (eq interpret 'type) last-state head)))
+ (org-todo to-state)
(org-entry-put nil "LAST_REPEAT" (format-time-string
(org-time-stamp-format t t)))
(when org-log-repeat
@@ -12663,7 +12676,7 @@ but in some other way.")
"LOCATION" "LOGGING" "COLUMNS" "VISIBILITY"
"TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE"
"EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE"
- "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER"
+ "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE"
"CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS")
"Some properties that are used by Org-mode for various purposes.
Being in this list makes sure that they are offered for completion.")