org-clock.el (org-clock-out): Fix bug.

* org-clock.el (org-clock-out): Fix bug: if a closing note
needs to be stored in the drawer where clocks are stored,
let's temporarily remove `org-clock-remove-empty-clock-drawer'
from `org-clock-out-hook'.

Thanks to Дядов Васил Стоянов for reporting this bug.
This commit is contained in:
Bastien Guerry 2013-03-02 17:39:23 +01:00
parent c8d5674562
commit 3b21f246d6
1 changed files with 9 additions and 1 deletions

View File

@ -1524,7 +1524,15 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
(force-mode-line-update)
(message (concat "Clock stopped at %s after HH:MM = " org-time-clocksum-format "%s") te h m
(if remove " => LINE REMOVED" ""))
(run-hooks 'org-clock-out-hook)
(let ((h org-clock-out-hook))
;; If a closing note needs to be stored in the drawer
;; where clocks are stored, let's temporarily disable
;; `org-clock-remove-empty-clock-drawer'
(if (and (equal org-clock-into-drawer org-log-into-drawer)
(eq org-log-done 'note)
org-clock-out-when-done)
(setq h (delq 'org-clock-remove-empty-clock-drawer h)))
(mapc (lambda (f) (funcall f)) h))
(unless (org-clocking-p)
(org-clock-delete-current)))))))