;;; ob.el --- working with code blocks in org-mode ;; Copyright (C) 2009-2012 Free Software Foundation, Inc. ;; Authors: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org ;; This file is part of GNU Emacs. ;; GNU Emacs 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 of the License, or ;; (at your option) any later version. ;; GNU Emacs 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. If not, see . ;;; Code: (require 'ob-eval) (require 'ob-core) (require 'ob-comint) (require 'ob-exp) (require 'ob-keys) (require 'ob-table) (require 'ob-lob) (require 'ob-ref) (require 'ob-tangle) ;;; Core defcustoms (defcustom org-babel-no-eval-on-ctrl-c-ctrl-c nil "Remove code block evaluation from the C-c C-c key binding." :group 'org-babel :version "24.1" :type 'boolean) (defcustom org-babel-results-keyword "RESULTS" "Keyword used to name results generated by code blocks. Should be either RESULTS or NAME however any capitalization may be used." :group 'org-babel :type 'string) (defcustom org-babel-noweb-wrap-start "<<" "String used to begin a noweb reference in a code block. See also `org-babel-noweb-wrap-end'." :group 'org-babel :type 'string) (defcustom org-babel-noweb-wrap-end ">>" "String used to end a noweb reference in a code block. See also `org-babel-noweb-wrap-start'." :group 'org-babel :type 'string) ;;; Export defcustoms (defcustom org-export-babel-evaluate t "Switch controlling code evaluation during export. When set to nil no code will be evaluated as part of the export process." :group 'org-babel :version "24.1" :type 'boolean) (put 'org-export-babel-evaluate 'safe-local-variable (lambda (x) (eq x nil))) (defcustom org-babel-exp-call-line-template "" "Template used to export call lines. This template may be customized to include the call line name with any export markup. The template is filled out using `org-fill-template', and the following %keys may be used. line --- call line An example value would be \"\\n: call: %line\" to export the call line wrapped in a verbatim environment. Note: the results are inserted separately after the contents of this template." :group 'org-babel :type 'string) (defcustom org-babel-exp-code-template "#+BEGIN_SRC %lang%flags\n%body\n#+END_SRC" "Template used to export the body of code blocks. This template may be customized to include additional information such as the code block name, or the values of particular header arguments. The template is filled out using `org-fill-template', and the following %keys may be used. lang ------ the language of the code block name ------ the name of the code block body ------ the body of the code block flags ----- the flags passed to the code block In addition to the keys mentioned above, every header argument defined for the code block may be used as a key and will be replaced with its value." :group 'org-babel :type 'string) ;;; Tangle defcustoms (defcustom org-babel-tangle-lang-exts '(("emacs-lisp" . "el")) "Alist mapping languages to their file extensions. The key is the language name, the value is the string that should be inserted as the extension commonly used to identify files written in this language. If no entry is found in this list, then the name of the language is used." :group 'org-babel-tangle :version "24.1" :type '(repeat (cons (string "Language name") (string "File Extension")))) (defcustom org-babel-post-tangle-hook nil "Hook run in code files tangled by `org-babel-tangle'." :group 'org-babel :version "24.1" :type 'hook) (defcustom org-babel-pre-tangle-hook '(save-buffer) "Hook run at the beginning of `org-babel-tangle'." :group 'org-babel :version "24.1" :type 'hook) (defcustom org-babel-tangle-body-hook nil "Hook run over the contents of each code block body." :group 'org-babel :version "24.1" :type 'hook) (defcustom org-babel-tangle-comment-format-beg "[[%link][%source-name]]" "Format of inserted comments in tangled code files. The following format strings can be used to insert special information into the output using `org-fill-template'. %start-line --- the line number at the start of the code block %file --------- the file from which the code block was tangled %link --------- Org-mode style link to the code block %source-name -- name of the code block Whether or not comments are inserted during tangling is controlled by the :comments header argument." :group 'org-babel :version "24.1" :type 'string) (defcustom org-babel-tangle-comment-format-end "%source-name ends here" "Format of inserted comments in tangled code files. The following format strings can be used to insert special information into the output using `org-fill-template'. %start-line --- the line number at the start of the code block %file --------- the file from which the code block was tangled %link --------- Org-mode style link to the code block %source-name -- name of the code block Whether or not comments are inserted during tangling is controlled by the :comments header argument." :group 'org-babel :version "24.1" :type 'string) (defcustom org-babel-process-comment-text #'org-babel-trim "Function called to process raw Org-mode text collected to be inserted as comments in tangled source-code files. The function should take a single string argument and return a string result. The default value is `org-babel-trim'." :group 'org-babel :version "24.1" :type 'function) ;;; Export defcustoms (defcustom org-babel-lob-files '() "Files used to populate the `org-babel-library-of-babel'. To add files to this list use the `org-babel-lob-ingest' command." :group 'org-babel :version "24.1" :type 'list) (provide 'ob) ;; Local variables: ;; generated-autoload-file: "org-loaddefs.el" ;; End: ;;; ob.el ends here