From 83cea905991b2761f98838cef9b867985d60c637 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Fri, 3 Feb 2017 22:51:56 +0100 Subject: [PATCH] org-clock: Do not associate a note to removed zero time CLOCKs * lisp/org-clock.el (org-clock-out): When a zero time CLOCK is removed, do not offer to add a note for it. --- lisp/org-clock.el | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index b513a938d..e6814229f 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1593,18 +1593,19 @@ to, overriding the existing value of `org-clock-out-switch-to-state'." m (floor (/ s 60)) s (- s (* 60 s))) (insert " => " (format "%2d:%02d" h m)) - (when (setq remove (and org-clock-out-remove-zero-time-clocks - (= (+ h m) 0))) - (beginning-of-line 1) - (delete-region (point) (point-at-eol)) - (and (looking-at "\n") (> (point-max) (1+ (point))) - (delete-char 1))) (move-marker org-clock-marker nil) (move-marker org-clock-hd-marker nil) - (when org-log-note-clock-out - (org-add-log-setup - 'clock-out nil nil nil - (concat "# Task: " (org-get-heading t) "\n\n"))) + ;; Possibly remove zero time clocks. However, do not add + ;; a note associated to the CLOCK line in this case. + (cond ((and org-clock-out-remove-zero-time-clocks + (= (+ h m) 0)) + (setq remove t) + (delete-region (line-beginning-position) + (line-beginning-position 2))) + (org-log-note-clock-out + (org-add-log-setup + 'clock-out nil nil nil + (concat "# Task: " (org-get-heading t) "\n\n")))) (when org-clock-mode-line-timer (cancel-timer org-clock-mode-line-timer) (setq org-clock-mode-line-timer nil)) -- 2.11.4.GIT