emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Update org-clock-out-time when resolving clocks
@ 2020-08-09 23:54 Benson Chu
  2020-08-17  4:13 ` Kyle Meyer
  0 siblings, 1 reply; 2+ messages in thread
From: Benson Chu @ 2020-08-09 23:54 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 717 bytes --]

Hello,

I noticed this while using `org-resolve-clocks' when
`org-clock-continuously' was set to true.

Let's say I clock into "Task 1" at 12:00, and then at 12:30, I start
working on "Task 2". Then, at 12:45, I notice that I forgot to clock out
of "Task 1". No worries, org-mode has `org-resolve-clocks'! So, I invoke
`org-resolve-clocks', keep 30 minutes, and then clock into "Task
2". However, when I clock in, the clock start time is 12:45, violating
the promise that `org-clock-continuously' makes.

This patch updates the variable `org-clock-out-time' when `org-clock-out'
gets passed an `at-time', which fixes the issue I run into.

The patch is attached. Is there anything else I need to do?

Thanks,
Benson


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-clock-out-time patch --]
[-- Type: text/x-patch, Size: 1030 bytes --]

From f78ed7389de153b4270c67df09eedaeb114dc64a Mon Sep 17 00:00:00 2001
From: Benson Chu <bensonchu457@gmail.com>
Date: Sun, 9 Aug 2020 17:57:51 -0500
Subject: [PATCH] org-clock.el: Update org-clock-out-time from
 org-resolve-clocks

* lisp/org-clock.el (org-clock-out): If `at-time' was passed, set
org-clock-out-time to that value. Otherwise, set it to now.
---
 lisp/org-clock.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index b184fc3a3..0dd495493 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1645,7 +1645,7 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
 	     org-clock-out-switch-to-state))
 	  (now (org-current-time org-clock-rounding-minutes))
 	  ts te s h m remove)
-      (setq org-clock-out-time now)
+      (setq org-clock-out-time (or at-time now))
       (save-excursion ; Do not replace this with `with-current-buffer'.
 	(with-no-warnings (set-buffer (org-clocking-buffer)))
 	(save-restriction
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-17  4:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-09 23:54 [PATCH] Update org-clock-out-time when resolving clocks Benson Chu
2020-08-17  4:13 ` Kyle Meyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).