Hi Ihor, I cannot answer your question, but I am curious about using async together with tangling, since for some of my buffers, tangling takes some time and freezes Emacs in the process. Do you have some examples of this that you could share? Thanks, --Diego On Thu, Dec 12, 2019 at 9:21 AM Ihor Radchenko wrote: > I am thinking if it is possible to implement org-agenda-redo > asynchronously. > > Rebuilding agenda should normally not affect any buffer except agenda > buffer. So, it should be sufficient to block any agenda modifying > commands in the agenda buffer, redo the agenda buffer in separate > thread, and replace the old agenda with the calculated one. > Then, emacs should remain responsive while updating agenda (except for > modifying the agenda buffer). > > For example, this naive code kind of works (forgetting that buffer-local > variables will not be passed to the thread): > > (define-advice org-agenda-redo (:around (oldfun &optional all) make-async) > (make-thread oldfun "org-agenda-redo")) > > The problem is that emacs does not become responsive... > > Another approach would be using async.el package, which allows calling > arbitrary function in subordinate emacs process. Then, the main emacs > instance should not be "frozen" (I use same approach for tangling and it > works fine). > > However, the question is how to pass the .org and agenda buffers to this > subordinate process. Opening the .org files there is not a good option > since it would give too much overhead to this asynchronous agenda. > > Any suggestions? Alternative ideas? > > Best, > Ihor > > >