emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thierry Banel <tbanelwebmin@free.fr>
To: emacs-orgmode@gnu.org
Subject: Re: Bug: Proposed new version of ob-C.el [8.3beta (release_8.3beta-944-g830cf3 @ /Users/snapp/.emacs.d/vendor/org/)]
Date: Mon, 30 Mar 2015 21:53:54 +0200	[thread overview]
Message-ID: <5519A9D2.8020502@free.fr> (raw)
In-Reply-To: <87wq1y35yn.fsf@alphaville.usersys.redhat.com>

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

Ok, 100% of votes are for the removal of wired #includes.
Here is the patch.  Tests are changed accordingly.

Thierry


Le 30/03/2015 16:39, Nick Dokos a écrit :
>
> IMO, it would be better than the current situation, but I wonder if
> it makes sense to have a global default setting containing the
> three files, but one which the user can customize; any :includes
> parameters would augment the default.
>
> That would satisfy the OP's requirements, but would also allow for
> a shorter #+BEGIN_SRC line.
>
> Nick
>
>


[-- Attachment #2: 0001-Remove-default-includes-in-Babel-C-C.patch --]
[-- Type: text/x-diff, Size: 1360 bytes --]

From 89eab423a0084a715456db558a987d6d806c49ba Mon Sep 17 00:00:00 2001
From: Thierry Banel <tbanelwebmin@free.fr>
Date: Mon, 30 Mar 2015 21:36:00 +0200
Subject: [PATCH] Remove default #includes in Babel C, C++

* ob-C.el (org-babel-C-expand-C): remove automatic inclusion
of <string.h>, <stdio.h>, <stdlib.h>

* ob-C-test.org: adjust C++ tests to manually include
required header files.
---
 lisp/ob-C.el                   | 1 -
 testing/examples/ob-C-test.org | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index 0857795..8d5ff2f 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -194,7 +194,6 @@ it's header arguments."
 		  nil)))
     (when (stringp includes)
       (setq includes (split-string includes)))
-    (setq includes (append includes '("<string.h>" "<stdio.h>" "<stdlib.h>")))
     (when (stringp defines)
       (let ((y nil)
 	    (result (list t)))
diff --git a/testing/examples/ob-C-test.org b/testing/examples/ob-C-test.org
index ab744f1..dcd1c48 100644
--- a/testing/examples/ob-C-test.org
+++ b/testing/examples/ob-C-test.org
@@ -129,7 +129,7 @@
   | sunday    |    4 |
 
 #+source: inhomogeneous_table
-#+begin_src cpp :var tinomogen=tinomogen :results silent
+#+begin_src cpp :var tinomogen=tinomogen :results silent :includes <string.h> <stdio.h>
 int main()
 {
   int i, j;
-- 
2.1.4


  reply	other threads:[~2015-03-30 19:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25  2:28 Robert Snapp
2015-03-29 20:48 ` Thierry Banel
2015-03-30 14:39   ` Nick Dokos
2015-03-30 19:53     ` Thierry Banel [this message]
2015-03-31 10:07       ` Nicolas Goaziou
2015-03-31 19:52         ` Thierry Banel
2015-03-31 22:14           ` Nick Dokos
2015-04-02 21:30             ` Thierry Banel

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=5519A9D2.8020502@free.fr \
    --to=tbanelwebmin@free.fr \
    --cc=emacs-orgmode@gnu.org \
    /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).