From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Include does not work when doing org-export-as-org Date: Tue, 11 Oct 2011 20:27:06 +0200 Message-ID: References: <20111011123829.GB17611@olymp.office.virtualminds.de> <6195.1318342189@alphaville.dokosmarshall.org> <6528.1318342888@alphaville.dokosmarshall.org> <6750.1318343276@alphaville.dokosmarshall.org> <20111011143414.GA25699@olymp.office.virtualminds.de> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:56333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDh2p-0004Zn-HK for Emacs-orgmode@gnu.org; Tue, 11 Oct 2011 14:27:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RDh2n-0006xD-Q7 for Emacs-orgmode@gnu.org; Tue, 11 Oct 2011 14:27:15 -0400 Received: from mail-ey0-f169.google.com ([209.85.215.169]:50457) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDh2n-0006x4-K6 for Emacs-orgmode@gnu.org; Tue, 11 Oct 2011 14:27:13 -0400 Received: by eye4 with SMTP id 4so2409080eye.0 for ; Tue, 11 Oct 2011 11:27:12 -0700 (PDT) In-Reply-To: <20111011143414.GA25699@olymp.office.virtualminds.de> 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: Henry Hirsch Cc: Emacs-orgmode@gnu.org On 11.10.2011, at 16:34, Henry Hirsch wrote: > On Tue, Oct 11, 2011 at 10:27:56AM -0400, Nick Dokos wrote: > >> In particular, I assume it does not process includes, because they need >> to be preserved in examples. >> >> Nick > > So do you think it is reasonable that org-export-as-org is the only mode > of export which is exhibiting a different behaviour? > > For my part I think it is not. > I used to love org-mode above everything. > But this just leaves me not amused. What made you get out of bed today in a bad mood? Maybe I can help to improve the communication by explaining where the problem lies. Both functionalities, the one that is implemented, and the one that you want make a lot of sense. The problem is merely a misnaming of the function. The reason why `org-export-to-org' was introduced was solely to provide a way for a website to publish the source file that was used to create a particular website, along with the website itself. An example can be found on Bernt's site. http://doc.norang.ca/org-mode.html#sec-18 What the function does is (Nick already collected this info) - remove archived trees and commented trees - remove trees that are excluded by special tags - output the resulting file with -source.org extension and optionally produce an htmlized version of this file so that the web visitor can look at the file. Processing of #include files was left out on purpose, because that often contains stuff which you want to have out of the way because it is tedious or complicated. In fact, a website can choose to also publish the source of the #include files as separate files. What you are looking for a mechanism to expand more directives, in order to produce another org file. You want (IIUC) a preprocessor much like a C compiler preprocessor. However, it is not automatic what this should do and what it should not do. For example - do you think it should expand macros? - oo you think it should process babel blocks and insert the evaluation results, as the other exporters do? - do you think it should process links into a standard format and pre-expand link searches? I suspect (but that is a guess, based on the description of your use-case) that your answer would be No to all these questions. Yet someone else could come in and take issue with the absence of this processing, with all the same right as you have to wonder about the absence of #include processing. It all depends and what you actually want to achieve, and the answer is *not* obvious. So while I am guilty of maybe misnaming this function, you will have noticed that this "exporter" actually does not show up in the export menu as an independent exporter - it is mainly used by publishing projects. We could use a new function which does a configurable amount of processing, maybe it could get a number of arguments which define what exactly should be done - and it should definitely write to a different file, without clobbering the current file. Maybe file_expanded.org or so? The way to write this function is to start at `org-export-as-org', keep what you like and add more stuff from org-export-preprocess, for example a call `org-export-handle-include-files-recurse' as one of the first things. Really, `org-export-preprocess-string' can be the guide of what can and should be done. I could write such a function, Nick could, but first there needs to be clarity of what this should achieve, and how to address this issue in a general way. - Carsten