org-babel-asymptote now supports interactive viewing if the :file header argument...
[org-mode.git] / contrib / babel / lisp / langs / org-babel-emacs-lisp.el
blob39f5cc7ff6dfc5420322bcf1792a3b88e24aa2b3
1 ;;; org-babel-emacs-lisp.el --- org-babel functions for emacs-lisp code evaluation
3 ;; Copyright (C) 2009 Eric Schulte
5 ;; Author: Eric Schulte
6 ;; Keywords: literate programming, reproducible research
7 ;; Homepage: http://orgmode.org
8 ;; Version: 0.01
10 ;;; License:
12 ;; This program is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; any later version.
17 ;; This program is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02110-1301, USA.
27 ;;; Commentary:
29 ;; Org-Babel support for evaluating emacs-lisp code
31 ;;; Code:
32 (require 'org-babel)
34 (org-babel-add-interpreter "emacs-lisp")
36 (add-to-list 'org-babel-tangle-langs '("emacs-lisp" "el"))
38 (defun org-babel-execute:emacs-lisp (body params)
39 "Execute a block of emacs-lisp code with org-babel. This
40 function is called by `org-babel-execute-src-block' via multiple-value-bind."
41 (message "executing emacs-lisp code block...")
42 (save-window-excursion
43 (let ((print-level nil) (print-length nil))
44 (eval `(let ,(mapcar (lambda (var) `(,(car var) ',(cdr var))) vars)
45 ,(read (concat "(progn " body ")")))))))
47 (provide 'org-babel-emacs-lisp)
48 ;;; org-babel-emacs-lisp.el ends here