From cd4ce4bd47398ae43d477d7a02af0e2139ddcc15 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Sun, 16 Aug 2009 17:53:06 -0600 Subject: [PATCH] adding org-src-lang-modes to map languages to their major modes --- lisp/org-exp.el | 6 +++++- lisp/org-src.el | 12 +++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 7e77fc5..bc413db 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2278,7 +2278,11 @@ INDENT was the original indentation of the block." "htmlize.el 1.34 or later is needed for source code formatting"))) (if lang - (let* ((mode (and lang (intern (concat lang "-mode")))) + (let* ((lang-m (when lang + (or (plist-get org-src-lang-modes + (intern (concat ":" lang))) + lang))) + (mode (and lang-m (intern (concat lang-m "-mode")))) (org-inhibit-startup t) (org-startup-folded nil)) (setq rtn diff --git a/lisp/org-src.el b/lisp/org-src.el index 2a6c087..028c545 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -109,6 +109,14 @@ You may want to use this hook for example to turn off `outline-minor-mode' or similar things which you want to have when editing a source code file, but which mess up the display of a snippet in Org exported files.") +(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." + :group 'org-edit-structure + :type 'plist) + ;;; Editing source examples (defvar org-src-mode-map (make-sparse-keymap)) @@ -151,7 +159,9 @@ the edited version." (setq beg (move-marker beg (nth 0 info)) end (move-marker end (nth 1 info)) code (buffer-substring-no-properties beg end) - lang (nth 2 info) + lang (or (plist-get org-src-lang-modes + (intern (concat ":" (nth 2 info)))) + (nth 2 info)) single (nth 3 info) lfmt (nth 4 info) nindent (nth 5 info) -- 1.6.4.73.gc144