Björn Kettunen <[email protected]> writes: > Ihor Radchenko <[email protected]> writes: > >> 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? > > Yes exactly. So that the call would be done after the archive file per > buffer is known. >> 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. > > How would you do that? For files without archives calling the function > could be done right before getting the table data. You can first form a full list of files via org-add-archive-files (if needed) in org-dblock-write:clocktable. Then, call org-agenda-prepare-buffers once. Then, call org-clock-get-table-data-with-archives and/or org-clock--get-table-data1. -- 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>
