forked from mirrors/org-mode
beginning to add sessions
This commit is contained in:
commit
517253a2d0
|
@ -36,6 +36,7 @@
|
||||||
(require 'org-babel-ref)
|
(require 'org-babel-ref)
|
||||||
(require 'org-babel-exp)
|
(require 'org-babel-exp)
|
||||||
(require 'org-babel-table)
|
(require 'org-babel-table)
|
||||||
|
(require 'org-babel-session)
|
||||||
|
|
||||||
;; language specific files
|
;; language specific files
|
||||||
(require 'org-babel-script)
|
(require 'org-babel-script)
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
(defun org-babel-script-add-interpreter (var cmds)
|
(defun org-babel-script-add-interpreter (var cmds)
|
||||||
(set-default var cmds)
|
(set-default var cmds)
|
||||||
(mapc (lambda (cmd)
|
(mapc (lambda (cmd)
|
||||||
(setq org-babel-interpreters (cons cmd org-babel-interpreters))
|
(org-babel-add-interpreter cmd)
|
||||||
(eval
|
(eval
|
||||||
`(defun ,(intern (concat "org-babel-execute:" cmd)) (body params)
|
`(defun ,(intern (concat "org-babel-execute:" cmd)) (body params)
|
||||||
,(concat "Evaluate a block of " cmd " script with org-babel. This function is
|
,(concat "Evaluate a block of " cmd " script with org-babel. This function is
|
||||||
|
@ -65,6 +65,8 @@ executed through org-babel."
|
||||||
:group 'org-babel
|
:group 'org-babel
|
||||||
:set 'org-babel-script-add-interpreter)
|
:set 'org-babel-script-add-interpreter)
|
||||||
|
|
||||||
|
(mapc #'org-babel-add-interpreter org-babel-script-interpreters)
|
||||||
|
|
||||||
(defun org-babel-script-execute (cmd body params)
|
(defun org-babel-script-execute (cmd body params)
|
||||||
"Run CMD on BODY obeying any options set with PARAMS."
|
"Run CMD on BODY obeying any options set with PARAMS."
|
||||||
(message (format "executing %s code block..." cmd))
|
(message (format "executing %s code block..." cmd))
|
||||||
|
|
46
lisp/org-babel-session.el
Normal file
46
lisp/org-babel-session.el
Normal file
|
@ -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
|
|
@ -34,7 +34,7 @@
|
||||||
(defun org-babel-shell-add-interpreter (var cmds)
|
(defun org-babel-shell-add-interpreter (var cmds)
|
||||||
(set-default var cmds)
|
(set-default var cmds)
|
||||||
(mapc (lambda (cmd)
|
(mapc (lambda (cmd)
|
||||||
(setq org-babel-interpreters (cons cmd org-babel-interpreters))
|
(org-babel-add-interpreter cmd)
|
||||||
(eval
|
(eval
|
||||||
`(defun ,(intern (concat "org-babel-execute:" cmd)) (body params)
|
`(defun ,(intern (concat "org-babel-execute:" cmd)) (body params)
|
||||||
,(concat "Evaluate a block of " cmd " shell with org-babel. This function is
|
,(concat "Evaluate a block of " cmd " shell with org-babel. This function is
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
|
||||||
;; See rorg.org in the parent directory for more information
|
;; See org-babel.org in the parent directory for more information
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(require 'org)
|
(require 'org)
|
||||||
|
@ -72,6 +72,7 @@ then run `org-babel-execute-src-block'."
|
||||||
`org-babel-src-block-regexp' appropriately."
|
`org-babel-src-block-regexp' appropriately."
|
||||||
(unless (member interpreter org-babel-interpreters)
|
(unless (member interpreter org-babel-interpreters)
|
||||||
(setq org-babel-interpreters (cons 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)))
|
(org-babel-set-interpreters 'org-babel-interpreters org-babel-interpreters)))
|
||||||
|
|
||||||
(defcustom org-babel-interpreters '()
|
(defcustom org-babel-interpreters '()
|
||||||
|
|
|
@ -115,7 +115,8 @@ and the results to be collected in the same table.
|
||||||
|
|
||||||
|
|
||||||
* Tasks [22/36]
|
* 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]
|
*** initial requirement statement [DED]
|
||||||
At the moment, objects created by computations performed in the
|
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
|
This should be implemented in the org-mode core
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*** DEFERRED send code to inferior process
|
*** DEFERRED send code to inferior process
|
||||||
Another thought on this topic: I think we will want users to send
|
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*
|
chunks of code to the interpreter from within the *Org Edit Src*
|
||||||
|
|
Loading…
Reference in a new issue