I have a lot of org files in emacs 27.1 so when I do an agenda listing for the week it takes about 20seconds. Is there a nice way to do this in the background? I've put together the following function and it sort of works. The Org Agenda buffer that it shows in the finish lambda is blank, but the agenda.org file is correct but it's just an org file not the special Org Agenda buffer.
(defun async-org-agenda-list()
(interactive)
(async-start
;; start
(lambda ()
(setq org-agenda-files '("~/org/" "~/org/projects"))
(org-agenda-list)
(switch-to-buffer "*Org Agenda*")
(append-to-file (point-min) (point-max) "~/agenda.org")
)
;; finish
(lambda (msg)
(message "done")
)
)
)
Is there a way to do the Agenda in the background and display it in the Org Agenda buffer in the correct mode?
(org-agenda)
rather than list?