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
This commit is contained in:
Carsten Dominik 2009-05-19 10:35:28 +02:00
parent b8a339e96f
commit 8e44b1fd8b
4 changed files with 37 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2009-05-19 Carsten Dominik <carsten.dominik@gmail.com>
* org.texi (Tracking TODO state changes): Document the
LOG_INTO_DRAWER property.
2009-05-16 Carsten Dominik <carsten.dominik@gmail.com>
* org.texi (Literal examples): Document the new implementation for

View File

@ -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

View File

@ -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.

View File

@ -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.")