diff --git a/lisp/org.el b/lisp/org.el index cee79db1d..16e70391e 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