From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: Bug in new exporter with babel blocks Date: Thu, 21 Feb 2013 13:11:09 -0500 Message-ID: <87liahsfk2.fsf@gmail.com> References: <87obggevdz.fsf@gmail.com> <87ehhc9gfn.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:56984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8ac3-0002Bm-06 for emacs-orgmode@gnu.org; Thu, 21 Feb 2013 13:11:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8abw-0005un-P5 for emacs-orgmode@gnu.org; Thu, 21 Feb 2013 13:11:18 -0500 Received: from mail-vc0-f173.google.com ([209.85.220.173]:40419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8abw-0005ue-KO for emacs-orgmode@gnu.org; Thu, 21 Feb 2013 13:11:12 -0500 Received: by mail-vc0-f173.google.com with SMTP id fy27so3012612vcb.18 for ; Thu, 21 Feb 2013 10:11:12 -0800 (PST) In-Reply-To: <87ehhc9gfn.fsf@gmail.com> 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: Nicolas Goaziou , emacs-orgmode@gnu.org Nicolas, Thank you for your explanations, which were very helpful. 2013ko urtarrilak 23an, Nicolas Goaziou-ek idatzi zuen: > You needn't. org-exp-blocks functionalities are supported by the new > exporter out of the box. Can you say more about this? I looked for but did not find a replacement to the org-export-blocks variable (an alist associating block types with functions to export them). I found it very easy to hook into the new exporter, but perhaps I missed something? > Special blocks are de facto, recursive, much like drawers. Their > contents have to be parsed. For parsing, yes. But for export I want a way to say =E2=80=9CI don=E2=80= =99t care what Org thinks the export of this block is. Give me the raw contents, and I will tell you what the export should be.=E2=80=9D This is how the ditaa special-block code used to work; I see that it has now morphed into a babel language, which makes some kind of sense. I=E2=80= =99m not sure it does in general. My use case is glossed examples for linguistics: my special block contains three lines, which are a sentence in a foreign language and a translation. By inserting markup in a way which is easy to automate, you can get LaTeX to align the words of one language with the words of the other. I don=E2=80=99t want any org processing of the text of the exam= ples: it might contain backslashes, stars, etc., all of which should be passed verbatim to LaTeX. This does not feel like source code, it cannot be evaluated or tangled, I would not want these blocks to be included in org-babel-next-src-block, etc. >> I=E2=80=99d also be happy to discover another, better way of getting the= raw >> text content of the special-block that doesn=E2=80=99t succumb to this >> problem. >=20 > If you must, you can try: >=20 > (org-element-interpret-data (org-element-contents special-block)) >=20 > from `org-e-latex-special-block'. I would up patching org-elements to add a :contents property to special-block elements, which is populated when parsing the original buffer (and thus dodges the different-buffer-for-export problem). I can then retrieve this in my export backend function. It is a very simple patch: -----------cut-here----------- diff --git i/lisp/org-element.el w/lisp/org-element.el index 3dc1e72..b67e5e6 100644 --- i/lisp/org-element.el +++ w/lisp/org-element.el @@ -1389,6 +1389,9 @@ Assume point is at the beginning of the block." :hiddenp hidden :contents-begin contents-begin :contents-end contents-end + :contents (and contents-begin contents-end + (buffer-substring-no-properties + contents-begin contents-end)) :post-blank (count-lines pos-before-blank end) :post-affiliated post-affiliated) (cdr affiliated))))))))) -----------cut-here----------- Is including support for special blocks that should be exported =E2=80=9Cra= w=E2=80=9D a compelling reason to install such a patch? I think the only downside would be increased memory usage/decreased speed for parsed objects (since they are now storing an extra string), but I think that would be very small (though I haven=E2=80=99t benchmarked anything). Thanks, --=20 Aaron Ecay