Use the `org-src-lang-modes' variable to associate a src code block name
with a major mode.  This list already contains ("cpp" . c++) for C++
code blocks, but perhaps ("C++" . c++) should be added as well.

Best,

Rasmus <ras...@gmx.us> writes:

> Hi,
>
> The Emacs C++ mode is called c++-mode.  In babel C++ is C++.  
> Hence, the following problematic case holds. 
>
> With the block, (lowercase c)
>
>   #+begin_src c++ 
>    ...
>   #+end_src
>
> I can edit it in the c++-mode and get nice fontification, but I can't
> execute it.
>
> With (capital c)
>
>   #+begin_src C++ 
>    ...
>   #+end_src
>
> I can execute the block in Org, but I can't edit it in c++-mode.
>
> I'm not very knowledgeable about Babel, so the best fix I could find
> was adding
>
>   (defalias 'C++-mode 'c++-mode)
>
> to the top of ob-c.el (after requiring cc-mode).  Of course C++ could
> also be renamed c++, but the correct name does in fact seem to use
> capitals (cf. Wikipedia).
>
> Ob-template didn't mention how to associate a language with a given
> mode.
>
> Cheers,
> Rasmus

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

Reply via email to