From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Suggestion about org-babel: executing source block asynchronously Date: Sun, 11 Oct 2015 10:12:52 +0200 Message-ID: <878u79kem3.fsf@nicolasgoaziou.fr> References: <56152A01.3EC491.19053@m12-14.163.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlBiq-0003jK-3D for emacs-orgmode@gnu.org; Sun, 11 Oct 2015 04:11:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZlBip-0006Ee-8i for emacs-orgmode@gnu.org; Sun, 11 Oct 2015 04:11:12 -0400 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:56640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlBip-0006EP-2x for emacs-orgmode@gnu.org; Sun, 11 Oct 2015 04:11:11 -0400 In-Reply-To: <56152A01.3EC491.19053@m12-14.163.com> (kuangdash@163.com's message of "Wed, 7 Oct 2015 22:19:29 +0800") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: kuangdash Cc: "emacs-orgmode@gnu.org" Hello, kuangdash writes: > Sometime I will run source block (such as python) which take a long time = before I=C2=A0 get the final result. > Then I thought about whether or not the source block can be executed asyn= chronously, and the answer is =E2=80=98YES=E2=80=99. > But it seems to be difficult for me to hack the code, so I just talk abou= t the process of it: > > 1)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 When execute source block, cover it up w= ith the =E2=80=9Cexecuting=E2=80=9D overlay. > 2)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 When get the final result, get the =E2= =80=9Cexecuting=E2=80=9D overlay position. > 3)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Add the result below the =E2=80=9Cexecut= ing=E2=80=9D overlay position, and then remove the overly. > > It can be done! =C2=A0How about it? It could be a start.=20 However, "add the result" in not simple, because you need to maintain a queue in order to insert results back during idle time. Also, insertion should preserve current window visibility so as to prevent jumping around. You may also need to cover the results part of the code block, if any. Regards, --=20 Nicolas Goaziou