From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ernesto Durante Subject: Re: babel: ob-C with Visual C++ and compilation-mode Date: Fri, 15 Aug 2014 19:22:02 +0200 Message-ID: <87lhqp7jnp.fsf@gmail.com> References: <878un4ut6c.fsf@gmail.com> <53E91C32.4000002@free.fr> <87lhqt6b0w.fsf@gmail.com> <53EA8F2B.7010205@free.fr> <87zjf8cdjk.fsf@gmail.com> <53ED1EB0.3030500@free.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XILCh-0006mU-3p for emacs-orgmode@gnu.org; Fri, 15 Aug 2014 13:22:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XILCY-0004tU-3D for emacs-orgmode@gnu.org; Fri, 15 Aug 2014 13:22:15 -0400 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:36089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XILCX-0004tN-TF for emacs-orgmode@gnu.org; Fri, 15 Aug 2014 13:22:06 -0400 Received: by mail-wi0-f181.google.com with SMTP id bs8so1100508wib.14 for ; Fri, 15 Aug 2014 10:22:04 -0700 (PDT) Received: from localhost.localdomain (col74-1-88-183-113-172.fbx.proxad.net. [88.183.113.172]) by mx.google.com with ESMTPSA id xn12sm8552687wib.13.2014.08.15.10.22.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Aug 2014 10:22:03 -0700 (PDT) In-Reply-To: <53ED1EB0.3030500@free.fr> (Thierry Banel's message of "Thu, 14 Aug 2014 22:40:16 +0200") 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: emacs-orgmode@gnu.org > Well... In this example, we go down from 9 lines to 7 lines. Ok fair. > But the price is a new syntax to learn: > ////main//// > Is it wise to add an org-mode specific syntax to C++ (which already has > a lot) ? > > Being noisy is a weakness of C++. > I think it is not the responsibility of org-mode to fix that. > > Now, org-mode is already able to process main()-less blocks in simple cases. > > #+BEGIN_SRC C++ > printf("hello\n"); > #+END_SRC > > If we can find a way to extend this feature to more cases, > without needing a long documentation, > then, sure, it would be a nice improvement. I agree with you. Creating a new syntax is not a good idea. However, in some way, ob-C has created a new syntax implicitly by instantiating a new main in absence of such a function in the source block. So why not to extend this idea by allowing a user defined function to parse the source block. The default function is clearly org-babel-C-ensure-main-wrap. We could create a new header :wrap which replaces :main and holds the user defined function. It can take three values nil, org-babel-C-ensure-main-wrap(default), or user-defined-function. So, in this way user-defined-function holds my own syntax for my future presentation. What do you think ? Best Ernesto