[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 5bc6741a5a: org-clock-update-time-maybe: Update the
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 5bc6741a5a: org-clock-update-time-maybe: Update the containing timestamps as well |
Date: |
Tue, 1 Nov 2022 03:57:56 -0400 (EDT) |
branch: externals/org
commit 5bc6741a5abd42e8305bb0fcfe78801813309640
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
org-clock-update-time-maybe: Update the containing timestamps as well
* lisp/org-clock.el (org-clock-update-time-maybe): Update the
containing timestamps inside the clock, not only the clock sum.
Reported-by: Bruce E. Robertson <brucer42@gmail.com>
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=53393
---
lisp/org-clock.el | 35 ++++++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index cedbdeffe1..603dbee3cb 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -3066,18 +3066,31 @@ Otherwise, return nil."
(org-time-string-to-time (match-string 1)))
(org-clock-update-mode-line)))
(t
- (and (match-end 4) (delete-region (match-beginning 4) (match-end 4)))
- (end-of-line 1)
- (setq ts (match-string 1)
- te (match-string 3))
- (setq s (- (org-time-string-to-seconds te)
+ ;; Prevent recursive call from `org-timestamp-change'.
+ (cl-letf (((symbol-function 'org-clock-update-time-maybe) #'ignore))
+ ;; Update timestamps.
+ (save-excursion
+ (goto-char (match-beginning 1)) ; opening timestamp
+ (save-match-data (org-timestamp-change 0 'day)))
+ ;; Refresh match data.
+ (looking-at re)
+ (save-excursion
+ (goto-char (match-beginning 3)) ; closing timestamp
+ (save-match-data (org-timestamp-change 0 'day))))
+ ;; Refresh match data.
+ (looking-at re)
+ (and (match-end 4) (delete-region (match-beginning 4) (match-end 4)))
+ (end-of-line 1)
+ (setq ts (match-string 1)
+ te (match-string 3))
+ (setq s (- (org-time-string-to-seconds te)
(org-time-string-to-seconds ts))
- neg (< s 0)
- s (abs s)
- h (floor (/ s 3600))
- s (- s (* 3600 h))
- m (floor (/ s 60))
- s (- s (* 60 s)))
+ neg (< s 0)
+ s (abs s)
+ h (floor (/ s 3600))
+ s (- s (* 3600 h))
+ m (floor (/ s 60))
+ s (- s (* 60 s)))
(insert " => " (format (if neg "-%d:%02d" "%2d:%02d") h m))
t))))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/org 5bc6741a5a: org-clock-update-time-maybe: Update the containing timestamps as well,
ELPA Syncer <=