From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: [ob][bug] C++-mode is unknown Date: Sat, 13 Jul 2013 16:41:20 +0200 Message-ID: <87zjtqed4f.fsf@pank.lan> References: <87ehb2fvsr.fsf@pank.lan> <87ip0ey3z5.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54144) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy10o-000700-Ti for emacs-orgmode@gnu.org; Sat, 13 Jul 2013 10:41:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uy10m-0002Pi-Dt for emacs-orgmode@gnu.org; Sat, 13 Jul 2013 10:41:26 -0400 Received: from mout.gmx.net ([212.227.15.15]:62693) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy10m-0002Pa-33 for emacs-orgmode@gnu.org; Sat, 13 Jul 2013 10:41:24 -0400 In-Reply-To: <87ip0ey3z5.fsf@gmail.com> (Eric Schulte's message of "Sat, 13 Jul 2013 07:38:38 -0600") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: schulte.eric@gmail.com Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eric Schulte writes: > 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. Thanks for the pointers! Do you find the attached patch acceptable? =E2=80=93Rasmus --=20 This space left intentionally blank --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Better-C-recognition.patch >From de9ffd3f5b3d36f149beafed7882ab78b86c5dd2 Mon Sep 17 00:00:00 2001 From: rasmus Date: Sat, 13 Jul 2013 16:30:04 +0200 Subject: [PATCH] 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. --- lisp/ob-C.el | 2 ++ lisp/org-src.el | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/ob-C.el b/lisp/ob-C.el index e9eec93..b0eaf6f 100644 --- a/lisp/ob-C.el +++ b/lisp/ob-C.el @@ -39,6 +39,8 @@ (defvar org-babel-tangle-lang-exts) (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 '()) diff --git a/lisp/org-src.el b/lisp/org-src.el index 81b8e40..0f88174 100644 --- a/lisp/org-src.el +++ b/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 '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist) ("asymptote" . asy) ("dot" . fundamental) ("sqlite" . sql) - ("calc" . fundamental) ("C" . c) ("cpp" . c++) + ("calc" . fundamental) ("C" . c) ("cpp" . c++) ("C++" . c++) ("screen" . shell-script)) "Alist mapping languages to their major mode. The key is the language name, the value is the string that should -- 1.8.3.2 --=-=-=--