diff --git a/lisp/org-babel-init.el b/lisp/org-babel-init.el index 9ece9bfde..53f8c741f 100644 --- a/lisp/org-babel-init.el +++ b/lisp/org-babel-init.el @@ -36,6 +36,7 @@ (require 'org-babel-ref) (require 'org-babel-exp) (require 'org-babel-table) +(require 'org-babel-session) ;; language specific files (require 'org-babel-script) diff --git a/lisp/org-babel-script.el b/lisp/org-babel-script.el index de164a42d..9885bcd42 100644 --- a/lisp/org-babel-script.el +++ b/lisp/org-babel-script.el @@ -34,7 +34,7 @@ (defun org-babel-script-add-interpreter (var cmds) (set-default var cmds) (mapc (lambda (cmd) - (setq org-babel-interpreters (cons cmd org-babel-interpreters)) + (org-babel-add-interpreter cmd) (eval `(defun ,(intern (concat "org-babel-execute:" cmd)) (body params) ,(concat "Evaluate a block of " cmd " script with org-babel. This function is @@ -65,6 +65,8 @@ executed through org-babel." :group 'org-babel :set 'org-babel-script-add-interpreter) +(mapc #'org-babel-add-interpreter org-babel-script-interpreters) + (defun org-babel-script-execute (cmd body params) "Run CMD on BODY obeying any options set with PARAMS." (message (format "executing %s code block..." cmd)) diff --git a/lisp/org-babel-session.el b/lisp/org-babel-session.el new file mode 100644 index 000000000..a63443ef1 --- /dev/null +++ b/lisp/org-babel-session.el @@ -0,0 +1,46 @@ +;;; org-babel-session.el --- session management for org-babel + +;; Copyright (C) 2009 Eric Schulte, Dan Davison + +;; Author: Eric Schulte, Dan Davison +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 0.01 + +;;; License: + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; Org-Babel evaluates code in the context of consistent sessions. +;; This file will hold functions for interacting with these sections. +;; +;; For more information see org-babel.org in the top level directory. + +;;; Code: +(require 'org-babel) + +(defcustom org-babel-session-defaults nil + "An a-list associating each org-babel interpreter with a +default session buffer." + :group 'org-babel + :type 'alist) + + + +(provide 'org-babel-session) +;;; org-babel-session.el ends here diff --git a/lisp/org-babel-shell.el b/lisp/org-babel-shell.el index 7e209446d..9430b1536 100644 --- a/lisp/org-babel-shell.el +++ b/lisp/org-babel-shell.el @@ -34,7 +34,7 @@ (defun org-babel-shell-add-interpreter (var cmds) (set-default var cmds) (mapc (lambda (cmd) - (setq org-babel-interpreters (cons cmd org-babel-interpreters)) + (org-babel-add-interpreter cmd) (eval `(defun ,(intern (concat "org-babel-execute:" cmd)) (body params) ,(concat "Evaluate a block of " cmd " shell with org-babel. This function is diff --git a/lisp/org-babel.el b/lisp/org-babel.el index f81b690b2..7d1327ba9 100644 --- a/lisp/org-babel.el +++ b/lisp/org-babel.el @@ -26,7 +26,7 @@ ;;; Commentary: -;; See rorg.org in the parent directory for more information +;; See org-babel.org in the parent directory for more information ;;; Code: (require 'org) @@ -72,6 +72,7 @@ then run `org-babel-execute-src-block'." `org-babel-src-block-regexp' appropriately." (unless (member interpreter org-babel-interpreters) (setq org-babel-interpreters (cons interpreter org-babel-interpreters)) + (add-to-list 'org-babel-session-defaults (cons interpreter (format "org-babel-%s" interpreter))) (org-babel-set-interpreters 'org-babel-interpreters org-babel-interpreters))) (defcustom org-babel-interpreters '() diff --git a/org-babel.org b/org-babel.org index 7bcb9e1cd..500db789b 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/36] -** TODO Create objects in top level (global) environment in R? [0/5] +** TODO Create objects in top level (global) environment [0/5] +*sessions* *** initial requirement statement [DED] At the moment, objects created by computations performed in the @@ -284,7 +285,6 @@ org-mode core This should be implemented in the org-mode core - *** 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*