Browse Source

just getting started

Eric Schulte 16 years ago
parent
commit
b60d873724
3 changed files with 21 additions and 8 deletions
  1. 8 6
      lisp/langs/org-babel-ruby.el
  2. 1 1
      lisp/org-babel.el
  3. 12 1
      org-babel.org

+ 8 - 6
lisp/langs/org-babel-ruby.el

@@ -104,11 +104,12 @@ Emacs-lisp table, otherwise return the results as a string."
 (defun org-babel-ruby-initiate-session (&optional session)
 (defun org-babel-ruby-initiate-session (&optional session)
   "If there is not a current inferior-process-buffer in SESSION
   "If there is not a current inferior-process-buffer in SESSION
 then create.  Return the initialized session."
 then create.  Return the initialized session."
-  (let ((session-buffer (save-window-excursion (run-ruby nil session) (current-buffer))))
-    (if (org-babel-comint-buffer-livep session-buffer)
-        session-buffer
-      (sit-for .5)
-      (org-babel-ruby-initiate-session session))))
+  (unless (string= session "none")
+    (let ((session-buffer (save-window-excursion (run-ruby nil session) (current-buffer))))
+      (if (org-babel-comint-buffer-livep session-buffer)
+          session-buffer
+        (sit-for .5)
+        (org-babel-ruby-initiate-session session)))))
 
 
 (defvar org-babel-ruby-last-value-eval "_"
 (defvar org-babel-ruby-last-value-eval "_"
   "When evaluated by Ruby this returns the return value of the last statement.")
   "When evaluated by Ruby this returns the return value of the last statement.")
@@ -124,7 +125,8 @@ last statement in BODY."
                                (list body org-babel-ruby-last-value-eval org-babel-ruby-eoe-indicator) "\n"))
                                (list body org-babel-ruby-last-value-eval org-babel-ruby-eoe-indicator) "\n"))
          (raw (org-babel-comint-with-output buffer org-babel-ruby-eoe-indicator t
          (raw (org-babel-comint-with-output buffer org-babel-ruby-eoe-indicator t
                 (insert full-body) (comint-send-input nil t)))
                 (insert full-body) (comint-send-input nil t)))
-         (results (cdr (member org-babel-ruby-eoe-indicator
+         (results 
+          (cdr (member org-babel-ruby-eoe-indicator
                                (reverse (mapcar #'org-babel-ruby-read-string
                                (reverse (mapcar #'org-babel-ruby-read-string
                                                 (mapcar #'org-babel-trim raw)))))))
                                                 (mapcar #'org-babel-trim raw)))))))
     (case result-type
     (case result-type

+ 1 - 1
lisp/org-babel.el

@@ -49,7 +49,7 @@ then run `org-babel-pop-to-session'."
 
 
 (add-hook 'org-metadown-hook 'org-babel-pop-to-session-maybe)
 (add-hook 'org-metadown-hook 'org-babel-pop-to-session-maybe)
 
 
-(defvar org-babel-default-header-args '()
+(defvar org-babel-default-header-args '((:session . "none"))
   "Default arguments to use when evaluating a source block.")
   "Default arguments to use when evaluating a source block.")
 
 
 (defvar org-babel-default-inline-header-args '((:results . "silent") (:exports . "results"))
 (defvar org-babel-default-inline-header-args '((:results . "silent") (:exports . "results"))

+ 12 - 1
org-babel.org

@@ -497,7 +497,7 @@ tabel
 
 
 Another example is in the [[*operations%20in%20on%20tables][grades example]].
 Another example is in the [[*operations%20in%20on%20tables][grades example]].
 
 
-** PROPOSED add =:none= session argument (for purely functional execution)
+** PROPOSED add =:none= session argument (for purely functional execution) [0/4]
 This would allow source blocks to be run in their own new process
 This would allow source blocks to be run in their own new process
 
 
 - These blocks could then also be run in the background (since we can
 - These blocks could then also be run in the background (since we can
@@ -519,6 +519,17 @@ Down-sides to sessions
 - can't run in background
 - can't run in background
 - litter emacs with session buffers
 - litter emacs with session buffers
 
 
+*** TODO ruby
+
+#+srcname: ruby-task-no-session
+#+begin_src ruby :session none
+puts :schulte
+[1, 2, 3]
+#+end_src
+
+*** TODO R
+*** TODO python
+*** TODO sh
 ** PROPOSED Are we happy with current behaviour regarding vector/scalar output?
 ** PROPOSED Are we happy with current behaviour regarding vector/scalar output?
 This simple example of multilingual chaining produces vector output if
 This simple example of multilingual chaining produces vector output if
 there are spaces in the message and scalar otherwise.
 there are spaces in the message and scalar otherwise.