From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: ob-clojure: possible to display results as soon as something is written to STDOUT? Date: Wed, 30 Mar 2016 12:58:54 -0400 Message-ID: References: <56FABF0C.5030808@fgiasson.com> <87mvpgnun2.fsf@ucl.ac.uk> <56FBC0EA.6080000@fgiasson.com> <56FBDDB4.90904@fgiasson.com> <56FBE840.8080700@fgiasson.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alJSP-0000jh-OX for emacs-orgmode@gnu.org; Wed, 30 Mar 2016 12:59:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alJSL-00025M-H7 for emacs-orgmode@gnu.org; Wed, 30 Mar 2016 12:59:01 -0400 Received: from mail-qg0-x233.google.com ([2607:f8b0:400d:c04::233]:32957) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alJSL-00025I-C5 for emacs-orgmode@gnu.org; Wed, 30 Mar 2016 12:58:57 -0400 Received: by mail-qg0-x233.google.com with SMTP id j35so44613703qge.0 for ; Wed, 30 Mar 2016 09:58:57 -0700 (PDT) In-reply-to: <56FBE840.8080700@fgiasson.com> 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: Frederick Giasson Cc: emacs-orgmode@gnu.org a Frederick Giasson writes: > Hi John, > >> you should rename it org-babel-async-execute:clojure, and adapt it to >> run clojure. > > Yes > >> I wrote the function in the org-file that is that post, and executed the >> code block (C-c C-c) which "registers" the function for that instance of >> emacs. > > I am not sure I understand here. Once you execute the elisp block with > that function, the function becomes defined for that instance. But when > you execute your other block, the example python block using C-c C-c, > how does org-mode knows to use "org-babel-async-execute:python" instead > of "org-babel-execute:python"?? > > You put the cursor in the block, and then call it using M-x? Right, with the cursor in the block type M-x org-babel-async-execute:clojure > >> Later you could put it in an init file that is loaded when Emacs starts. >> >> and use M-x to call it. Once I added an :async option to the header args >> to make C-c C-c execute it, but until it works the way you want with M-x >> that is just convenience ;) > > Yes, this is that :async option that would be great and necessary once > it works using M-x :) > > How can this be done? (Is there an extension mechanism in org-mode for > that, or it needs to hack the core code?) You can see a commented out version for shell blocks here: https://github.com/jkitchin/jmax/blob/master/jmax-org.el#L936 It looks like I just redefined the org-babel-execute:sh function after it was loaded. That may not be recommended good practice, but it works ;) I am not sure why it is commented out, maybe because I don't use it alot and its not well tested. You could always bind your own key sequence instead of C-c C-c. > > Thanks, > > > Fred -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu