From 796b4ec43bef813fc482ca996e8dc2ee3f09200a Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Fri, 27 Jul 2012 17:24:16 +0200 Subject: [PATCH] org-clock.el: Set the marker for `org-clock-history' at a safer position. * org-clock.el (org-clock-in): Set the marker for `org-clock-history' at a safer position. The clock marker stored in `org-clock-history' used to be at the beginning of the heading. When manually inserting content here, the marker is not updated because it is *before* the point. So set the clock marker right after the first "*" of the headline so that it will always be correctly updated. --- lisp/org-clock.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 4e85cb3d0..3e0c586a3 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1146,7 +1146,12 @@ clock in by using the last clock-out time as the start time (goto-char target-pos) (org-back-to-heading t) (or interrupting (move-marker org-clock-interrupted-task nil)) - (org-clock-history-push) + (save-excursion + (forward-char) ;; make sure the marker is not at the + ;; beginning of the heading, since the + ;; user is liking to insert stuff here + ;; manually + (org-clock-history-push)) (org-clock-set-current) (cond ((functionp org-clock-in-switch-to-state) (looking-at org-complex-heading-regexp)