fix: update `org-clock-agg--parse-clocks' for org 9.7.11

This commit is contained in:
Pavel Korytov 2025-11-20 16:02:11 +03:00
parent 27c54bfb78
commit e8cfd456bc

View file

@ -216,30 +216,31 @@ Return a list of alists with the following keys:
- `:start' - start time in seconds since the epoch - `:start' - start time in seconds since the epoch
- `:end' - end time in seconds since the epoch - `:end' - end time in seconds since the epoch
- `:duration' - duration in seconds." - `:duration' - duration in seconds."
(let ((contents (buffer-substring-no-properties (save-restriction
;; contents-begin starts after the headline ;; I used to insert a substring into a separate buffer to run
(org-element-property :contents-begin headline) ;; `org-element-parse-buffer', but somehow this broke on the most
(org-element-property :contents-end headline)))) ;; recent `org-mode'.
(with-temp-buffer (narrow-to-region
(insert contents) (org-element-property :contents-begin headline)
(let (res) (org-element-property :contents-end headline))
(org-element-map (org-element-parse-buffer) 'clock (let (res)
(lambda (clock) (org-element-map (org-element-parse-buffer) 'clock
(let ((start (time-convert (lambda (clock)
(org-timestamp-to-time (org-element-property :value clock)) (let ((start (time-convert
'integer)) (org-timestamp-to-time (org-element-property :value clock))
(end (time-convert 'integer))
(org-timestamp-to-time (org-element-property :value clock) t) (end (time-convert
'integer))) (org-timestamp-to-time (org-element-property :value clock) t)
(push 'integer)))
`((:start . ,start) (push
(:end . ,end) `((:start . ,start)
(:duration . ,(- end start))) (:end . ,end)
res))) (:duration . ,(- end start)))
;; The last argument stops parsing after the first headline. res)))
;; So only clocks in the first headline are parsed. ;; The last argument stops parsing after the first headline.
nil nil 'headline) ;; So only clocks in the first headline are parsed.
res)))) nil nil 'headline)
res)))
(defun org-clock-agg--properties-at-point () (defun org-clock-agg--properties-at-point ()
"Return a list of selected properties at point. "Return a list of selected properties at point.