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