From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Problem with noweb-ref property Date: Mon, 02 Jan 2012 11:01:29 -0700 Message-ID: <87k45ac6q4.fsf@gmx.com> References: <87wr9frwa7.fsf@gmx.com> <87obum70ae.fsf@med.uni-goettingen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:46275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhmOn-0004dv-QC for emacs-orgmode@gnu.org; Mon, 02 Jan 2012 13:14:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RhmOm-0002kE-5u for emacs-orgmode@gnu.org; Mon, 02 Jan 2012 13:14:17 -0500 Received: from mailout-us.gmx.com ([74.208.5.67]:48988 helo=mailout-us.mail.com) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1RhmOl-0002k8-SC for emacs-orgmode@gnu.org; Mon, 02 Jan 2012 13:14:16 -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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Andreas Leha Cc: emacs-orgmode@gnu.org Andreas Leha writes: > Tomas Grigera writes: >> Hi Eric, >> >> Thanks a lot for your quick reply and fix. Getting the git repo >> version scares me a bit, but I guess I'll just have to take the >> plunge! Here we go :) >> >> Thanks again, >> >> Tomas >> >> On Thu, Dec 29, 2011 at 16:51, Eric Schulte wrote: >>> Tomas Grigera writes: >>> >>>> Hi list, >>>> >>>> This is my first post, so just let me say first that I have been using >>>> org-mode for 10 months or so and I love it. It's an exceptional >>>> package, and before I ask my question I would just like to thank >>>> Carsten, Bastien, and the community for the great work and for >>>> sharing. >>>> >>>> Now my question: I am trying to extract code from a .org file by >>>> tangling with noweb-style references. As I understand from the manual, >>>> if I write <> in a code block, the line will be expanded with the >>>> code block named foo. This name I can set with #+NAME: =C2=A0or with t= he >>>> :noweb-ref header argument. Both ways work for me, except that I >>>> cannont set the :noweb-ref argument through a property. >>>> >>>> The following example is almost verbatim from the manual: >>>> >>>> #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh >>>> <> >>>> #+END_SRC >>>> >>>> * the mount point of the fullest disk >>>> >>>> ** query all mounted disks >>>> >>>> #+HEADER: :noweb-ref fullest-disk >>>> #+BEGIN_SRC sh >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 df \ >>>> #+END_SRC >>>> >>>> >>>> ** strip the header row >>>> =C2=A0 :PROPERTIES: >>>> =C2=A0 :noweb-ref: fullest-disk >>>> =C2=A0 :END: >>>> #+BEGIN_SRC sh :noweb yes >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 |sed '1d' \ >>>> #+END_SRC >>>> >>>> >>>> If I understand correctly, tangling should produce a file which is a >>>> concatenation of the two code blocks. However, when I do >>>> org-babel-tangle, only the first block =C2=A0 is inserted. Am I doing >>>> something wrong? >>>> >>>> I'm with emacs 23.2.1 and org-mode 7.8.02 >>>> >>>> Thanks in advance, >>>> >>>> Tomas >>>> >>> >>> Hi Tomas, >>> >>> You are correct the behavior described above is a bug introduced by a >>> fairly recent commit of mine which switched to using regular expressions >>> when resolving noweb references in an attempt to decrease the time >>> required to tangle code blocks (which can be significant in large code >>> blocks). >>> >>> However correct performance is more important than fast performance. >>> I've just pushed up a patch which fixes the bug you've described, and >>> hopefully doesn't slow down the tangling process too significantly. >>> >>> Cheers, >>> >>> -- >>> Eric Schulte >>> http://cs.unm.edu/~eschulte/ > > Hi Eric, > > unfortunately, for me it does result in a considerably slow down. > (Well, I did not bisect this time but still suspect the commit you > mention in this thread.) > > As a test case you can still use > http://pastebin.com/c42jS1Be > from my last post on this matter and expand the first source block. > > Sorry to ask again: Would it be possible to speed things up again or to > make the :noweb-ref feature optional? > Hi Andreas, I've just pushed up a new variable to the git repository. To enable the faster regexp-based method of noweb expansion (which is not able to resolve noweb-ref header arguments inherited from sub-tree or file-wide properties) put the following in your config. (setq *org-babel-use-quick-and-dirty-noweb-expansion* t) Best, > > Regards, > Andreas > > > > --=20 Eric Schulte http://cs.unm.edu/~eschulte/