org-babel-lob.el 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ;;; org-babel-lob.el --- The Library of Babel: off-the-shelf functions for data analysis and plotting using org-babel
  2. ;; Copyright (C) 2009 Dan Davison, Eric Schulte
  3. ;; Author: Dan Davison, Eric Schulte
  4. ;; Keywords: literate programming, reproducible research
  5. ;; Homepage: http://orgmode.org
  6. ;; Version: 0.01
  7. ;;; License:
  8. ;; This program is free software; you can redistribute it and/or modify
  9. ;; it under the terms of the GNU General Public License as published by
  10. ;; the Free Software Foundation; either version 3, or (at your option)
  11. ;; any later version.
  12. ;;
  13. ;; This program is distributed in the hope that it will be useful,
  14. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;; GNU General Public License for more details.
  17. ;;
  18. ;; You should have received a copy of the GNU General Public License
  19. ;; along with GNU Emacs; see the file COPYING. If not, write to the
  20. ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21. ;; Boston, MA 02110-1301, USA.
  22. ;;; Commentary:
  23. ;; See org-babel.org in the parent directory for more information
  24. ;;; Code:
  25. (require 'org)
  26. (defvar org-babel-lob-regexp
  27. (concat "#\\+babel[ \t]*"
  28. "\\([ \t]+\\([^\n]+\\)\\)?\n") ;; match header arguments
  29. "Regexp used to test when on a babel library line")
  30. (defun org-babel-lob-execute-maybe ()
  31. "Detect if this is a babel library line and if so
  32. then run `org-babel-lob-execute'."
  33. (interactive)
  34. (let ((info (org-babel-get-src-block-info)))
  35. (if info (progn (org-babel-execute-src-block current-prefix-arg info) t) nil)))
  36. (add-hook 'org-ctrl-c-ctrl-c-hook 'org-babel-lob-call)
  37. (defun org-babel-lob-execute ()
  38. "Execute an org-babel library function."
  39. (interactive)
  40. (provide 'org-babel-lob)