Björn Kettunen <[email protected]> writes:

>> The merge table data function can largely stay the
>> same but the determination of what has to be merged should be adjusted.
>
> Here's my updated patch. I added a small helper function to reuse the
> same path whenever the scope is cons files or file-with-archives.

Thanks!

> +(defun org-clock-merge-table-data (tables &optional file)
> +  "Merge table data for TABLES for FILE.
> +When FILE isn't given assume FILE as the file of the first table.
> +TABLES is list of table data returned in the format returned by
> +`org-clock-get-table-data'.
> +Returns the same tables but with each table merged."
> +  (let* ((file (or file (caaar tables)))
> +        ;; Make sure that the first element of the first table
> +        ;; was a file-name.
> +        (file (and (stringp file) file))
> +        (total-time 0) entries)
> +    (while-let ((table (pop tables)))
> +      (incf total-time (nth 1 table))
> +      (when-let* ((new-entries (car (nthcdr 2 table))))
> +
> +        (setq entries  (append new-entries entries))))
> +  (list file total-time
> +        entries )))

Any particular reason why you don't use the code I suggested?

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to