summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2009-05-27 18:54:44 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2009-05-27 18:54:44 +0200
commita18546c360e6d0d4b736041716540ba320ed5bf2 (patch)
treedc908a4e58b1aa3513e8fbae3cae1700189ecae9
parentca79257ca680bc73ea9df517e27c5b17a26d225a (diff)
downloadorg-mode-a18546c360e6d0d4b736041716540ba320ed5bf2.tar.gz
TODO entries: Control over when selecting a state is treated as state change.
This commit introduces two new variables: - org-treat-insert-todo-heading-as-state-change Default is nil. When set to t, adding a new TODO item will be done by adding an item and the executing an "official" state change which potentially will trigger state logging. - org-treat-S-cursor-todo-seletion-as-state-change Default is t. When set to nil, selecting a TODO state with S-left/right will not trigger logging, only selecting a new state with `C-c C-t'. I actually like this a lot and would even consider making this the default.
-rw-r--r--doc/ChangeLog5
-rw-r--r--doc/org.texi8
-rwxr-xr-xlisp/ChangeLog11
-rw-r--r--lisp/org.el31
4 files changed, 50 insertions, 5 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog
index c5d9c26..c3b37f8 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-27 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org.texi (Structure editing, TODO basics): Document new
+ variables.
+
2009-05-21 Carsten Dominik <carsten.dominik@gmail.com>
* org.texi (Column attributes): Document new colciew operators.
diff --git a/doc/org.texi b/doc/org.texi
index 1f61f34..5211fa1 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -958,7 +958,9 @@ current heading, the new heading is placed after the body instead of before
it. This command works from anywhere in the entry.
@kindex M-S-@key{RET}
@item M-S-@key{RET}
-Insert new TODO entry with same level as current heading.
+@vindex org-treat-insert-todo-heading-as-state-change
+Insert new TODO entry with same level as current heading. See also the
+variable @code{org-treat-insert-todo-heading-as-state-change}.
@kindex C-S-@key{RET}
@item C-S-@key{RET}
Insert new TODO entry with same level as current heading. Like
@@ -3193,12 +3195,14 @@ more information.
@kindex S-@key{right}
@kindex S-@key{left}
+@vindex org-treat-S-cursor-todo-seletion-as-state-change
@item S-@key{right}
@itemx S-@key{left}
Select the following/preceding TODO state, similar to cycling. Useful
mostly if more than two TODO states are possible (@pxref{TODO
extensions}). See also @ref{Conflicts} for a discussion of the interaction
-with @code{shift-selection-mode}.
+with @code{shift-selection-mode}. See also the variable
+@code{org-treat-S-cursor-todo-seletion-as-state-change}.
@kindex C-c C-v
@kindex C-c / t
@cindex sparse tree, for TODO
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index dad4a2d..39fd869 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
+2009-05-27 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org.el (org-treat-insert-todo-heading-as-state-change)
+ (org-treat-S-cursor-todo-seletion-as-state-change): New
+ variables.
+ (org-insert-todo-heading): Honor
+ `org-treat-insert-todo-heading-as-state-change'.
+ (org-shiftright, org-shiftleft): Honor
+ `org-treat-S-cursor-todo-seletion-as-state-change'.
+ (org-inhibit-logging): New variable.
+
2009-05-23 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-remove-subtree-entries-from-agenda): Reduce
diff --git a/lisp/org.el b/lisp/org.el
index 2fb80c4..a781091 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1817,6 +1817,22 @@ to change is while Emacs is running is through the customize interface."
:group 'org-todo
:type 'boolean)
+(defcustom org-treat-insert-todo-heading-as-state-change nil
+ "Non-nil means, inserting a TODO heading is treated as state change.
+So when the command \\[org-insert-todo-heading] is used, state change
+logging will apply if appropriate. When nil, the new TODO item will
+be inserted directly, and no logging will take place."
+ :group 'org-todo
+ :type 'boolean)
+
+(defcustom org-treat-S-cursor-todo-seletion-as-state-change t
+ "Non-nil means, switching TODO states with S-cursor counts as state change.
+This is the default behavior. However, setting this to nil allows a
+convenient way to select a TODO state and bypass any logging associated
+with that."
+ :group 'org-todo
+ :type 'boolean)
+
(defcustom org-todo-state-tags-triggers nil
"Tag changes that should be triggered by TODO state changes.
This is a list. Each entry is
@@ -3811,6 +3827,7 @@ This variable is set by `org-before-change-function'.
"Mode hook for Org-mode, run after the mode was turned on.")
(defvar org-inhibit-startup nil) ; Dynamically-scoped param.
(defvar org-agenda-keep-modes nil) ; Dynamically-scoped param.
+(defvar org-inhibit-logging nil) ; Dynamically-scoped param.
(defvar org-table-buffer-is-an nil)
(defconst org-outline-regexp "\\*+ ")
@@ -5495,7 +5512,9 @@ state (TODO by default). Also with prefix arg, force first state."
new-mark-x)))
(beginning-of-line 1)
(and (looking-at "\\*+ ") (goto-char (match-end 0))
- (insert new-mark " ")))
+ (if org-treat-insert-todo-heading-as-state-change
+ (org-todo new-mark)
+ (insert new-mark " "))))
(when org-provide-todo-statistics
(org-update-parent-todo-statistics))))
@@ -9120,6 +9139,7 @@ Each function takes arguments (NEW-MARK OLD-MARK) and returns either
`nil' or a string to be used for the todo mark." )
(defvar org-agenda-headline-snapshot-before-repeat)
+
(defun org-todo (&optional arg)
"Change the TODO state of an item.
The state of an item is given by a keyword at the start of the heading,
@@ -9278,6 +9298,7 @@ For calling through lisp, arg is also interpreted in the following way:
(not (member this org-done-keywords))))
(and logging (org-local-logging logging))
(when (and (or org-todo-log-states org-log-done)
+ (not org-inhibit-logging)
(not (memq arg '(nextset previousset))))
;; we need to look at recording a time and note
(setq dolog (or (nth 1 (assoc state org-todo-log-states))
@@ -14475,7 +14496,9 @@ Depending on context, this does one of the following:
((org-at-timestamp-p t) (call-interactively 'org-timestamp-up-day))
((and (not (eq org-support-shift-select 'always))
(org-on-heading-p))
- (org-call-with-arg 'org-todo 'right))
+ (let ((org-inhibit-logging
+ (not org-treat-S-cursor-todo-seletion-as-state-change)))
+ (org-call-with-arg 'org-todo 'right)))
((or (and org-support-shift-select
(not (eq org-support-shift-select 'always))
(org-at-item-bullet-p))
@@ -14505,7 +14528,9 @@ Depending on context, this does one of the following:
((org-at-timestamp-p t) (call-interactively 'org-timestamp-down-day))
((and (not (eq org-support-shift-select 'always))
(org-on-heading-p))
- (org-call-with-arg 'org-todo 'left))
+ (let ((org-inhibit-logging
+ (not org-treat-S-cursor-todo-seletion-as-state-change)))
+ (org-call-with-arg 'org-todo 'left)))
((or (and org-support-shift-select
(not (eq org-support-shift-select 'always))
(org-at-item-bullet-p))