From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: How to set a default language for source blocks? Date: Tue, 17 Feb 2015 20:51:53 +0100 Message-ID: <87r3to48py.fsf@gmx.us> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNoBs-0001kE-Fe for emacs-orgmode@gnu.org; Tue, 17 Feb 2015 14:52:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNoBe-000094-1x for emacs-orgmode@gnu.org; Tue, 17 Feb 2015 14:52:16 -0500 Received: from plane.gmane.org ([80.91.229.3]:48460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNoBd-00008c-SF for emacs-orgmode@gnu.org; Tue, 17 Feb 2015 14:52:02 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YNoBb-0003sx-V6 for emacs-orgmode@gnu.org; Tue, 17 Feb 2015 20:51:59 +0100 Received: from 46.166.186.221 ([46.166.186.221]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 17 Feb 2015 20:51:59 +0100 Received: from rasmus by 46.166.186.221 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 17 Feb 2015 20:51:59 +0100 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 Grant Rettke writes: > Just read [this] question. It is interesting. We always want to optimize > our documents. Re-use reduces errors. Defining `:header-args:foo: > :session *bar*' is a great example. Rather than having to type it 100 > times all over, just do it once. It never occurred to be that we might > want to default the language for a source block. It should have. It > would be simpler to say "this whole document will be R source blocks, > unless I specify other wise". I looked at [the spec]. I wanted to obtain > this behavior. I couldn't figure out how. Is it possible? I didn't look > at the parser, is that the right place to look to answer questions like > this? You don't have to check the implementation, you can simply check the Org syntax¹. Blocks Like greater blocks, pattern for blocks is: #+BEGIN_NAME DATA CONTENTS #+END_NAME NAME cannot contain any whitespace character. [...] If it is “SRC”, it will be a “source block” [...] DATA can contain any character but a new line. It can be ommitted, unless the block is a “source block”. In this case, it must follow the pattern “LANGUAGE SWITCHES ARGUMENTS”, where SWITCHES and ARGUMENTS are optional. —Rasmus Footnotes: ¹ http://orgmode.org/worg/dev/org-syntax.html -- The right to be left alone is a human right