From 3b21f246d6f00671e28b82bf963f259febd41573 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sat, 2 Mar 2013 17:39:23 +0100 Subject: [PATCH] org-clock.el (org-clock-out): Fix bug. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. --- lisp/org-clock.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index a536d025c..b89e64403 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -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)))))))