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

> -      (org-agenda-prepare-buffers (if (consp files) files (list files)))
> +      (unless (consp files)
> +        (org-agenda-prepare-buffers (list files)))

Could you please explain this change?
  
> +(defun org-clock--get-table-data1 (file params)
> +  "Get clocktable-data for FILE with PARAMS."
> +  (org-agenda-prepare-buffers (list file))

Did you mean that (consp files) imply that the above will happen?

Also, (org-agenda-prepare-buffers (list file)) is sub-optimal.
org-agenda-prepare-buffers updates the menus, which is slow to do when
adding files one by one. So, it is better to call
org-agenda-prepare-buffers are few times as possible, on a list of files.

> +(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)))
> +         (total-time 0) entries)
> +    (while-let ((table (pop tables)))
> +      (incf total-time (nth 1 table))
> +      (when-let* ((new-entries (cddar table)))
> +        (setq entries (append new-entries entries))))

when-let here is redundant.

(append '(1) nil) ; => '(1)
(append '(1) nil '(2)) ; => '(1 2)

-- 
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