diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2010-07-02 11:32:38 -0700 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2010-07-05 11:14:49 -0700 |
commit | 6e469f4afba4bf7d6e8983d1e4f3e981252f8f60 (patch) | |
tree | 5a3d7c79a3546d69d5906b7d689fed65a72877c4 | |
parent | 0ea1432d319cbf6bc82ed924b25d03070c570f10 (diff) | |
download | org-mode-6e469f4afba4bf7d6e8983d1e4f3e981252f8f60.tar.gz |
babel: `org-babel-load-languages' activates code blocks by language
* lisp/org.el (org-babel-load-languages): this variable controls which
languages will be loaded by org-babel. It is customizable through
the customize interface.
(org-babel-do-load-languages): load those languages in
org-babel-load-languages and disable those with nil cdr's
-rw-r--r-- | lisp/org.el | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/lisp/org.el b/lisp/org.el index cee79db..16e7039 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -119,7 +119,63 @@ (require 'ob-tangle) (require 'ob-comint) (require 'ob-keys) -(require 'ob-emacs-lisp) + +;; load languages based on value of `org-babel-load-languages' +(defun org-babel-do-load-languages (sym value) + "Load the languages defined in `org-babel-load-languages'." + (set-default sym value) + (mapc (lambda (pair) + (let ((active (cdr pair)) (lang (symbol-name (car pair)))) + (if active + (progn + (message "Activating %s..." lang) + (require (intern (concat "ob-" lang)))) + (progn + (message "Disabling %s..." lang) + (funcall 'fmakunbound + (intern (concat "org-babel-execute:" lang))) + (funcall 'fmakunbound + (intern (concat "org-babel-expand-body:" lang))))))) + org-babel-load-languages)) + +(defcustom org-babel-load-languages '((emacs-lisp . t)) + "Languages which can be evaluated in Org-mode buffers. This +list can be used to load support for any of the languages below, +note that each language will depend on a different set of system +executables and/or Emacs modes. When a language is \"loaded\", +then code blocks in that language can be evaluated with +`org-babel-execute-src-block' bound by default to C-c C-c (note +the `org-babel-no-eval-on-ctrl-c-ctrl-c' variable can be set to +remove code block evaluation from the C-c C-c keybinding. By +default only Emacs Lisp (which has no requirements) is loaded." + :group 'org-babel + :set 'org-babel-do-load-languages + :type '(alist :tag "Babel Languages" + :key-type + (choice + (const :tag "C" C) + (const :tag "R" R) + (const :tag "Asymptote" asymptote) + (const :tag "Clojure" clojure) + (const :tag "CSS" css) + (const :tag "Ditaa" ditaa) + (const :tag "Dot" dot) + (const :tag "Emacs Lisp" emacs-lisp) + (const :tag "Gnuplot" gnuplot) + (const :tag "Haskell" haskell) + (const :tag "Latex" latex) + (const :tag "Matlab" matlab) + (const :tag "Ocaml" ocaml) + (const :tag "Octave" octave) + (const :tag "Perl" perl) + (const :tag "Python" python) + (const :tag "Ruby" ruby) + (const :tag "Sass" sass) + (const :tag "Screen" screen) + (const :tag "Shell Script" sh) + (const :tag "Sql" sql) + (const :tag "Sqlite" sqlite)) + :value-type (boolean :tag "Activate" :value t))) ;;;; Customization variables (defcustom org-clone-delete-id nil |