From fcd5e8f2724cd65c89c1249d7197911a3bb7ccdc Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 1 Jun 2009 17:28:34 -0700 Subject: [PATCH] fleshing out the *sessions* discussion and TODOs --- org-babel.org | 91 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 69 insertions(+), 22 deletions(-) diff --git a/org-babel.org b/org-babel.org index f22ba2fdf..b0a594771 100644 --- a/org-babel.org +++ b/org-babel.org @@ -115,7 +115,8 @@ and the results to be collected in the same table. * Tasks [22/35] -** TODO Create objects in top level (global) environment in R? +** TODO Create objects in top level (global) environment in R? [1/8] + *** initial requirement statement [DED] At the moment, objects created by computations performed in the code block are evaluated in the scope of the @@ -187,7 +188,22 @@ Please let me know if you foresee any problems with this proposed setup, or if you think any parts might be confusing for people coming from Sweave. I'll hopefully find some time to work on this later in the week. -*** further requirement: make it play nicely with ESS [DED] + +*** TODO implement a *session* header argument +*** TODO remove source bodies from their functional wrappers +The current functional wrappers should be removed in favor of +incremental evaluation in inferior-source-buffers + +*** TODO function to bring up inferior-process buffer +This should be callable from inside of a source-code block in an +org-mode buffer. It should evaluation the header arguments, then +bring up the inf-proc buffer using =pop-to-buffer=. + +*** TODO function to dump last N lines from inf-proc buffer into source block +Callable with a prefix argument to specify how many lines should be +dumped into the source-code buffer. + +*** TODO set buffer-local-process variables appropriately [DED] I think something like this would be great. You've probably already thought of this, but just to note it down: it would be really nice if org-babel's notion of a buffer's 'session/process' played @@ -195,12 +211,21 @@ nicely with ESS's notion of the buffer's session/process. ESS keeps the current process name for a buffer in a buffer-local variable ess-local-process-name. So one thing we will probably want to do is make sure that the *Org Edit Src Example* buffer sets that variable -appropriately. +appropriately. [DED] +I had not thought of that, but I agree whole heartedly. [Eric] + +Once this is done every variable should be able to dump regions into +their inferior-process buffer using major-mode functions. + +*** TODO some possible requests/proposed changes for Carsten [2/3] While I remember, some possible requests/proposed changes for Carsten come to mind in that regard: -**** a hook called when the src edit buffer is created -**** Remap C-x C-s to save the source to the org buffer? + +**** DEFERRED a hook called when the src edit buffer is created +This should be implemented in the org-mode core + +**** DEFERRED Remap C-x C-s to save the source to the org buffer? I've done this personally and I find it essential. I'm using #+begin_src emacs-lisp (defun org-edit-src-save () @@ -217,7 +242,10 @@ buffer." (define-key org-exit-edit-mode-map "\C-x\C-s" 'org-edit-src-save) #+end_src which seems to work. -**** Rename buffer and minor mode? + +I think this is great, but I think it should be implemented in the +org-mode core +**** TODO Rename buffer and minor mode? Something shorter than *Org Edit Src Example* for the buffer name. org-babel is bringing org's source code interaction to a level of maturity where the 'example' is no longer @@ -225,24 +253,43 @@ buffer." the minor mode then maybe org-edit-src-mode is a better name than org-exit-edit-mode. -*** need to evaluate header arguments whenever we switch to *Org Edit Src* buffer - Another thought on this topic: I think we will want users to send chunks -of code to the interpreter from within the *Org Edit Src* buffer, and I -think that's what you have in mind already. In ESS that is done using -the ess-eval-* functions. That seems to imply that the header references -need to be evaluated and transformed into the target language object -when we hit C-c ' to enter the *Org Edit Src* buffer (or at least before -the first time we attempt to evaluate code in that buffer -- I suppose -there might be an argument for lazy evaluation, in case someone hits C-c -' but is "just looking" and not actually evaluating anything.) Of course -if evaluating the reference is computationally intensive then the user -might have to wait before they get the *Org Edit Src* buffer. + Maybe we should name the buffer with a combination of the source + code and the session. I think that makes sense. -*** implementation -in [[file:lisp/org-babel-comint.el][org-babel-comint.el]] + Are you also suggesting a new org-edit-src minor mode? -Currently I've coppied and begun generalizing the functions for -interacting with R buffers. +*** DEFERRED send code to inferior process +Another thought on this topic: I think we will want users to send +chunks of code to the interpreter from within the *Org Edit Src* +buffer, and I think that's what you have in mind already. In ESS that +is done using the ess-eval-* functions. [DED] + +I think we can leave this up to the major-mode in the source code +buffer, as almost every source-code major mode will have functions for +doing things like sending regions to the inferior process. If +anything we might need to set the value of the buffer local inferior +process variable. [Eric] + +*** TODO optionally evaluate header references when we switch to =*Org Edit Src*= buffer +That seems to imply that the header references need to be evaluated +and transformed into the target language object when we hit C-c ' to +enter the *Org Edit Src* buffer [DED] + +Good point, I heartily agree that this should be supported [Eric] + +(or at least before the first time we attempt to evaluate code in that +buffer -- I suppose there might be an argument for lazy evaluation, in +case someone hits C-c ' but is "just looking" and not actually +evaluating anything.) Of course if evaluating the reference is +computationally intensive then the user might have to wait before they +get the *Org Edit Src* buffer. [DED] + +I fear that it may be hard to anticipate when the references will be +needed, some major-modes do on-the-fly evaluation while the buffer is +being edited. I think that we should either do this before the buffer +is opened or not at all, specifically I think we should resolve +references if the user calls C-c ' with a prefix argument. Does that +sound reasonable? [Eric] ** TODO fully purge org-babel-R of direct comint interaction try to remove all code under the [[file:lisp/org-babel-R.el::functions%20for%20evaluation%20of%20R%20code][;; functions for evaluation of R code]] line