From mboxrd@z Thu Jan 1 00:00:00 1970 From: Diego Zamboni Subject: Re: Asynchronous org-agenda-redo Date: Thu, 12 Dec 2019 13:51:34 +0100 Message-ID: References: <87k172ot2m.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000026e0e90599813552" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:42643) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifNwb-0001M2-Dg for emacs-orgmode@gnu.org; Thu, 12 Dec 2019 07:51:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifNwa-0003CE-6l for emacs-orgmode@gnu.org; Thu, 12 Dec 2019 07:51:49 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:37668) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifNwZ-000374-KG for emacs-orgmode@gnu.org; Thu, 12 Dec 2019 07:51:48 -0500 Received: by mail-wr1-x42d.google.com with SMTP id w15so2619774wru.4 for ; Thu, 12 Dec 2019 04:51:47 -0800 (PST) In-Reply-To: <87k172ot2m.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Ihor Radchenko Cc: emacs-orgmode Mailinglist --00000000000026e0e90599813552 Content-Type: text/plain; charset="UTF-8" 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 > > > --00000000000026e0e90599813552 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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. D= o you have some examples of this that you could share?

=
Thanks,
--Diego


On Thu, Dec 12, 2019 at = 9:21 AM Ihor Radchenko <yantar92@g= mail.com> 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-asy= nc)
=C2=A0 (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).=C2=A0

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


--00000000000026e0e90599813552--