浏览代码

Better C++ recognition

* ob-C.el: Added =C++= to =`org-babel-load-languages'=
automatically after loading =C=.
* org-src.el (org-src-lang-modes): Added association between
language =C++= and =`c++-mode'=.

=C++= is added to org-babel-load-languages to make
`org-babel-demarcate-block' recognize =C++= as a proper language.
rasmus 12 年之前
父节点
当前提交
6727f1aa75
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 2 0
      lisp/ob-C.el
  2. 1 1
      lisp/org-src.el

+ 2 - 0
lisp/ob-C.el

@@ -39,6 +39,8 @@
 
 
 (defvar org-babel-tangle-lang-exts)
 (defvar org-babel-tangle-lang-exts)
 (add-to-list 'org-babel-tangle-lang-exts '("C++" . "cpp"))
 (add-to-list 'org-babel-tangle-lang-exts '("C++" . "cpp"))
+(let ((x (member '(C . t) org-babel-load-languages)))
+  (setcdr x  (cons '(C++ . t) (subseq x 1))))
 
 
 (defvar org-babel-default-header-args:C '())
 (defvar org-babel-default-header-args:C '())
 
 

+ 1 - 1
lisp/org-src.el

@@ -179,7 +179,7 @@ but which mess up the display of a snippet in Org exported files.")
 (defcustom org-src-lang-modes
 (defcustom org-src-lang-modes
   '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist)
   '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist)
     ("asymptote" . asy) ("dot" . fundamental) ("sqlite" . sql)
     ("asymptote" . asy) ("dot" . fundamental) ("sqlite" . sql)
-    ("calc" . fundamental) ("C" . c) ("cpp" . c++)
+    ("calc" . fundamental) ("C" . c) ("cpp" . c++) ("C++" . c++)
     ("screen" . shell-script))
     ("screen" . shell-script))
   "Alist mapping languages to their major mode.
   "Alist mapping languages to their major mode.
 The key is the language name, the value is the string that should
 The key is the language name, the value is the string that should