org-babel now using the org-src-lang-modes variable newly added to org-mode

This commit is contained in:
Eric Schulte 2009-08-23 12:38:16 -06:00
parent 9e8b776c83
commit 6d4404f4cb

View file

@ -39,15 +39,6 @@ shebang(#!) line to use when writing out the language to file,
and an optional flag indicating that the language is not and an optional flag indicating that the language is not
commentable.") commentable.")
;; This is just a place holder until this variable (or comparable) is
;; inserted into org-mode
(defcustom org-src-lang-modes
'(:ocaml "tuareg")
"Property list mapping languages to their major mode.
The key is the language name, the value is the string that should
be inserted as the name of the major mode."
:type 'plist)
(defun org-babel-load-file (file) (defun org-babel-load-file (file)
"Load the contents of the Emacs Lisp source code blocks in the "Load the contents of the Emacs Lisp source code blocks in the
org-mode formatted FILE. This function will first export the org-mode formatted FILE. This function will first export the
@ -88,8 +79,8 @@ exported source code blocks by language."
(let* ((lang (car by-lang)) (let* ((lang (car by-lang))
(specs (cdr by-lang)) (specs (cdr by-lang))
(lang-f (intern (concat (lang-f (intern (concat
(or (plist-get org-src-lang-modes (or (symbol-name
(intern (concat ":" lang))) (cdr (assoc lang org-src-lang-modes)))
lang) lang)
"-mode"))) "-mode")))
(lang-specs (cdr (assoc lang org-babel-tangle-langs))) (lang-specs (cdr (assoc lang org-babel-tangle-langs)))
@ -222,8 +213,8 @@ the source-code block which holds BODY."
(setq new-body (concat new-body text)))) (setq new-body (concat new-body text))))
(with-temp-buffer (with-temp-buffer
(insert body) (goto-char (point-min)) (insert body) (goto-char (point-min))
(funcall (intern (concat (or (plist-get org-src-lang-modes (funcall (intern (concat (or (symbol-name
(intern (concat ":" lang))) (cdr (assoc lang org-src-lang-modes)))
lang) "-mode"))) lang) "-mode")))
(setq index (point)) (setq index (point))
(while (and (re-search-forward "<<\\(.+\\)>>" nil t)) (while (and (re-search-forward "<<\\(.+\\)>>" nil t))