From 8e44b1fd8b4c3f749be0082ea4c08ddeebc30c01 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 19 May 2009 10:35:28 +0200 Subject: [PATCH] Logging: New property LOG_INTO_DRAWER Setting this property will overrule the value of org-log-into-drawer for the scope of the subtree. Requested by Daniel J. Sinder --- doc/ChangeLog | 5 +++++ doc/org.texi | 12 +++++++----- lisp/ChangeLog | 5 +++++ lisp/org.el | 26 ++++++++++++++++++++------ 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 4347b72a4..8c028ad16 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2009-05-19 Carsten Dominik + + * org.texi (Tracking TODO state changes): Document the + LOG_INTO_DRAWER property. + 2009-05-16 Carsten Dominik * org.texi (Literal examples): Document the new implementation for diff --git a/doc/org.texi b/doc/org.texi index de5b507b1..375ecddef 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -3572,7 +3572,7 @@ giving you an overview of what has been done. @cindex drawer, for state change recording @vindex org-log-states-order-reversed -@vindex org-log-state-notes-into-drawer +@vindex org-log-into-drawer When TODO keywords are used as workflow states (@pxref{Workflow states}), you might want to keep track of when a state change occurred and maybe take a note about this change. You can either record just a timestamp, or a @@ -3580,8 +3580,10 @@ timestamped note for a change. These records will be inserted after the headline as an itemized list, newest first@footnote{See the variable @code{org-log-states-order-reversed}}. When taking a lot of notes, you might want to get the notes out of a way into a drawer (@pxref{Drawers}). -Customize the variable @code{org-log-state-notes-into-drawer} to get this -behavior - the recommended drawer for this is called @code{LOGBOOK}. +Customize the variable @code{org-log-into-drawer} to get this +behavior - the recommended drawer for this is called @code{LOGBOOK}. You can +also overrule the setting of this variable for a subtree by setting a +@code{LOG_INTO_DRAWER} property. Since it is normally too much to record a note for every state, Org mode expects configuration on a per-keyword basis for this. This is achieved by @@ -6981,10 +6983,10 @@ Decrease the priority of the current item. @c @kindex z @item z -@vindex org-log-state-notes-into-drawer +@vindex org-log-into-drawer Add a note to the entry. This note will be recorded, and then files to the same location where state change notes a put. Depending on -@code{org-log-state-notes-into-drawer}, this maybe inside a drawer. +@code{org-log-into-drawer}, this maybe inside a drawer. @c @kindex C-c C-a @item C-c C-a diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 47026c023..c22f4ee85 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,11 @@ * org.el (org-todo-statistics-hook): New hook. (org-update-parent-todo-statistics): Use new hook. + (org-log-into-drawer): New function. + (org-add-log-setup): Use the new `org-log-into-drawer' function to + determine if we should be logging into a drawer. + (org-log-into-drawer): Update docstring. + (org-default-properties): Add LOG_INTO_DRAWER as a property. * org-list.el (org-checkbox-statistics-hook): New hook. (org-update-checkbox-count-maybe): Use new hook. diff --git a/lisp/org.el b/lisp/org.el index 9b415e35d..5ac5e81e0 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1917,7 +1917,10 @@ also set this to a string to define the drawer of your choice. A value of t is also allowed, representing \"LOGBOOK\". If this variable is set, `org-log-state-notes-insert-after-drawers' -will be ignored." +will be ignored. + +You can set the property LOG_INTO_DRAWER to overrule this setting for +a subtree." :group 'org-todo :group 'org-progress :type '(choice @@ -1928,6 +1931,16 @@ will be ignored." (if (fboundp 'defvaralias) (defvaralias 'org-log-state-notes-into-drawer 'org-log-into-drawer)) +(defun org-log-into-drawer () + "Return the value of `org-log-into-drawer', but let properties overrule. +If the current entry has or inherits a LOG_INTO_DRAWER property, it will be +used instead of the default value." + (let ((p (ignore-errors (org-entry-get nil "LOG_INTO_DRAWER" 'inherit)))) + (cond + ((or (not p) (equal p "nil")) org-log-into-drawer) + ((equal p "t") "LOGBOOK") + (t p)))) + (defcustom org-log-state-notes-insert-after-drawers nil "Non-nil means, insert state change notes after any drawers in entry. Only the drawers that *immediately* follow the headline and the @@ -9931,10 +9944,11 @@ When FINDPOS is non-nil, find the correct position for the note in the current entry. If not, assume that it can be inserted at point. HOW is an indicator what kind of note should be created. EXTRA is additional text that will be inserted into the notes buffer." - (let ((drawer (cond ((stringp org-log-into-drawer) - org-log-into-drawer) - (org-log-into-drawer "LOGBOOK") - (t nil)))) + (let* ((org-log-into-drawer (org-log-into-drawer)) + (drawer (cond ((stringp org-log-into-drawer) + org-log-into-drawer) + (org-log-into-drawer "LOGBOOK") + (t nil)))) (save-restriction (save-excursion (when findpos @@ -11371,7 +11385,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") + "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER") "Some properties that are used by Org-mode for various purposes. Being in this list makes sure that they are offered for completion.")