emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: schulte.eric@gmail.com
Cc: emacs-orgmode@gnu.org
Subject: Re: [ob][bug] C++-mode is unknown
Date: Sat, 13 Jul 2013 16:41:20 +0200	[thread overview]
Message-ID: <87zjtqed4f.fsf@pank.lan> (raw)
In-Reply-To: <87ip0ey3z5.fsf@gmail.com> (Eric Schulte's message of "Sat, 13 Jul 2013 07:38:38 -0600")

[-- Attachment #1: Type: text/plain, Size: 393 bytes --]

Eric Schulte <schulte.eric@gmail.com> 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?

–Rasmus

-- 
This space left intentionally blank

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Better-C-recognition.patch --]
[-- Type: text/x-diff, Size: 1608 bytes --]

From de9ffd3f5b3d36f149beafed7882ab78b86c5dd2 Mon Sep 17 00:00:00 2001
From: rasmus <rasmus@gmx.us>
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


  reply	other threads:[~2013-07-13 14:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-13 13:12 [ob][bug] C++-mode is unknown Rasmus
2013-07-13 13:23 ` Rasmus
2013-07-13 21:53   ` export to markdown Rill
2013-07-13 22:08     ` Suvayu Ali
     [not found]       ` <51E1D61E.9050502@yahoo.com>
2013-07-14  7:49         ` Suvayu Ali
2013-07-14 17:35           ` Rill
2013-07-13 13:38 ` [ob][bug] C++-mode is unknown Eric Schulte
2013-07-13 14:41   ` Rasmus [this message]
2013-07-13 17:59     ` Rasmus
2013-07-13 18:39       ` Eric Schulte
2013-07-13 18:59         ` Rasmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zjtqed4f.fsf@pank.lan \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).