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
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)
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.
29
;; Org-Babel support for evaluating emacs-lisp code
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."
40
(message "executing emacs-lisp code block...")
41
(save-window-excursion
42
(let* ((processed-params (org-babel-process-params params))
43
(result-params (third processed-params))
44
(vars (second (org-babel-process-params params)))
45
(print-level nil) (print-length nil))
46
(eval `(let ,(mapcar (lambda (var) `(,(car var) ',(cdr var)))
48
,(read (concat "(progn "
49
(if (or (member "code" result-params)
50
(member "pp" result-params))
51
(concat "(pp " body ")") body)
54
(provide 'org-babel-emacs-lisp)
55
;;; org-babel-emacs-lisp.el ends here