diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1ed8b9427..d02645530 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2008-10-15 James TD Smith + * org.el (org-add-log-setup): Only skip drawers if the are + immediately after the scheduling keywords. + * org-clock.el (org-clock-in-switch-to-state): Allow this to be a function (org-clock-in): If `org-clock-in-switch-to-state' is a function, diff --git a/lisp/org.el b/lisp/org.el index 6d7c09727..91d2546d9 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1515,7 +1515,9 @@ empty string. (defcustom org-log-state-notes-insert-after-drawers nil "Non-nil means, insert state change notes after any drawers in entry. -When nil, insert them right after the heading and perhaps the line +Only the drawers that *immediately* follow the headline and the +deadline/scheduled line are skipped. +When nil, insert notes right after the heading and perhaps the line with deadline/scheduling if present." :group 'org-todo :group 'org-progress @@ -8392,15 +8394,18 @@ EXTRA is additional text that will be inserted into the notes buffer." (org-back-to-heading t) (narrow-to-region (point) (save-excursion (outline-next-heading) (point))) - (when org-log-state-notes-insert-after-drawers - (while (re-search-forward - (concat "\\(" org-drawer-regexp - "\\|" org-property-end-re "\\)") - (point-max) t) (forward-line))) (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*" "\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp "[^\r\n]*\\)?")) (goto-char (match-end 0)) + (when (and org-log-state-notes-insert-after-drawers + (save-excursion + (forward-line) (looking-at org-drawer-regexp))) + (progn (forward-line) + (while (looking-at org-drawer-regexp) + (goto-char (match-end 0)) + (re-search-forward org-property-end-re (point-max) t) + (forward-line)))) (unless org-log-states-order-reversed (and (= (char-after) ?\n) (forward-char 1)) (org-skip-over-state-notes)