From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Export tangle filename with source block Date: Tue, 11 Oct 2016 20:57:31 +0200 Message-ID: <87pon6pvc4.fsf@nicolasgoaziou.fr> References: <87bn1ewjvd.fsf@dell-desktop.WORKGROUP> <87r37qzl8c.fsf@dell-desktop.WORKGROUP> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bu2F2-0003vZ-8P for emacs-orgmode@gnu.org; Tue, 11 Oct 2016 14:57:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bu2F1-0002xW-Bg for emacs-orgmode@gnu.org; Tue, 11 Oct 2016 14:57:32 -0400 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:59069) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bu2F1-0002wc-6l for emacs-orgmode@gnu.org; Tue, 11 Oct 2016 14:57:31 -0400 In-Reply-To: <87r37qzl8c.fsf@dell-desktop.WORKGROUP> (Thibault Marin's message of "Sat, 08 Oct 2016 14:36:35 -0500") 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" To: Thibault Marin Cc: Org Mode Hello, Thibault Marin writes: > *Question 1*: Is the `org-element-src-block-parser' function supposed to resolve > the tangle filename (including inheritance, i.e. to handle the 3 :tangle > sources listed above)? No, it isn't. > From the docstring, it would appear that it shouldn't return a :tangle keyword > and that the tangling functions are responsible for choosing the output tangle > file for each block. Is this correct? That's correct. > ** Improvements (which I cannot get to work) > > - Add collected blocks to `info' in order to perform the collection only once > and re-use it for subsequent blocks: I couldn't get it to work, function > arguments seem to be passed by value (?) They are not. You may want to see how cache is used with info in, e.g., `org-export-get-footnote-definition'. > - Use `org-babel-tangle-single-block' to process only one block at a time, this > sounds like the right method. I believe I must first move point to the > src-block being processed, which I try to do with > (org-babel-goto-named-src-block src-block-name): this gives me the correct > tangle filename when run from a simple code snippet in the scratch buffer > (using (org-element-map (org-element-parse-buffer) ...)), but results in the > wrong tangle file when I do that within the `my-html-src-block' function (the > :tangle options passed on the #+BEGIN_SRC line as in case 3. are ignored and > are always preempted by the inherited tangle value coming either from the > ,#+PROPERTY entry or the PROPERTY drawer value). *Question 2*: How can I use > `org-babel-tangle-single-block' within the custom src-block handling function? > I notice the (point) value is different after the > (org-babel-goto-named-src-block src-block-name) call when used from the > `my-html-src-block' function (possibly due to some pre-processing performed on > the buffer, I am not sure). The buffer used during export is unlikely to be the same as the original one. Macros are expanded, comments are removed and Babel code is possibly evaluated. The only hook run in an exact copy of the original buffer is `org-export-before-processing-hook'. You can collect anything here, but INFO doesn't exist yet. Regards, -- Nicolas Goaziou