* Problem with noweb-ref property
@ 2011-12-29 19:13 Tomas Grigera
2011-12-29 19:51 ` Eric Schulte
0 siblings, 1 reply; 6+ messages in thread
From: Tomas Grigera @ 2011-12-29 19:13 UTC (permalink / raw)
To: emacs-orgmode
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 <<foo>> in a code block, the line will be expanded with the
code block named foo. This name I can set with #+NAME: or with the
: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
<<fullest-disk>>
#+END_SRC
* the mount point of the fullest disk
** query all mounted disks
#+HEADER: :noweb-ref fullest-disk
#+BEGIN_SRC sh
df \
#+END_SRC
** strip the header row
:PROPERTIES:
:noweb-ref: fullest-disk
:END:
#+BEGIN_SRC sh :noweb yes
|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 is inserted. Am I doing
something wrong?
I'm with emacs 23.2.1 and org-mode 7.8.02
Thanks in advance,
Tomas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Problem with noweb-ref property
2011-12-29 19:13 Problem with noweb-ref property Tomas Grigera
@ 2011-12-29 19:51 ` Eric Schulte
2011-12-29 23:16 ` Tomas Grigera
0 siblings, 1 reply; 6+ messages in thread
From: Eric Schulte @ 2011-12-29 19:51 UTC (permalink / raw)
To: Tomas Grigera; +Cc: emacs-orgmode
Tomas Grigera <tgrigera@gmail.com> 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 <<foo>> in a code block, the line will be expanded with the
> code block named foo. This name I can set with #+NAME: or with the
> :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
> <<fullest-disk>>
> #+END_SRC
>
> * the mount point of the fullest disk
>
> ** query all mounted disks
>
> #+HEADER: :noweb-ref fullest-disk
> #+BEGIN_SRC sh
> df \
> #+END_SRC
>
>
> ** strip the header row
> :PROPERTIES:
> :noweb-ref: fullest-disk
> :END:
> #+BEGIN_SRC sh :noweb yes
> |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 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/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Problem with noweb-ref property
2011-12-29 19:51 ` Eric Schulte
@ 2011-12-29 23:16 ` Tomas Grigera
2012-01-02 12:32 ` Andreas Leha
0 siblings, 1 reply; 6+ messages in thread
From: Tomas Grigera @ 2011-12-29 23:16 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode
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 <eric.schulte@gmx.com> wrote:
> Tomas Grigera <tgrigera@gmail.com> 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 <<foo>> in a code block, the line will be expanded with the
>> code block named foo. This name I can set with #+NAME: or with the
>> :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
>> <<fullest-disk>>
>> #+END_SRC
>>
>> * the mount point of the fullest disk
>>
>> ** query all mounted disks
>>
>> #+HEADER: :noweb-ref fullest-disk
>> #+BEGIN_SRC sh
>> df \
>> #+END_SRC
>>
>>
>> ** strip the header row
>> :PROPERTIES:
>> :noweb-ref: fullest-disk
>> :END:
>> #+BEGIN_SRC sh :noweb yes
>> |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 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/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Problem with noweb-ref property
2011-12-29 23:16 ` Tomas Grigera
@ 2012-01-02 12:32 ` Andreas Leha
2012-01-02 18:01 ` Eric Schulte
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Leha @ 2012-01-02 12:32 UTC (permalink / raw)
To: emacs-orgmode
Tomas Grigera <tgrigera@gmail.com> 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 <eric.schulte@gmx.com> wrote:
>> Tomas Grigera <tgrigera@gmail.com> 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 <<foo>> in a code block, the line will be expanded with the
>>> code block named foo. This name I can set with #+NAME: or with the
>>> :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
>>> <<fullest-disk>>
>>> #+END_SRC
>>>
>>> * the mount point of the fullest disk
>>>
>>> ** query all mounted disks
>>>
>>> #+HEADER: :noweb-ref fullest-disk
>>> #+BEGIN_SRC sh
>>> df \
>>> #+END_SRC
>>>
>>>
>>> ** strip the header row
>>> :PROPERTIES:
>>> :noweb-ref: fullest-disk
>>> :END:
>>> #+BEGIN_SRC sh :noweb yes
>>> |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 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?
Regards,
Andreas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Problem with noweb-ref property
2012-01-02 12:32 ` Andreas Leha
@ 2012-01-02 18:01 ` Eric Schulte
2012-01-03 10:07 ` Andreas Leha
0 siblings, 1 reply; 6+ messages in thread
From: Eric Schulte @ 2012-01-02 18:01 UTC (permalink / raw)
To: Andreas Leha; +Cc: emacs-orgmode
Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
> Tomas Grigera <tgrigera@gmail.com> 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 <eric.schulte@gmx.com> wrote:
>>> Tomas Grigera <tgrigera@gmail.com> 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 <<foo>> in a code block, the line will be expanded with the
>>>> code block named foo. This name I can set with #+NAME: or with the
>>>> :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
>>>> <<fullest-disk>>
>>>> #+END_SRC
>>>>
>>>> * the mount point of the fullest disk
>>>>
>>>> ** query all mounted disks
>>>>
>>>> #+HEADER: :noweb-ref fullest-disk
>>>> #+BEGIN_SRC sh
>>>> df \
>>>> #+END_SRC
>>>>
>>>>
>>>> ** strip the header row
>>>> :PROPERTIES:
>>>> :noweb-ref: fullest-disk
>>>> :END:
>>>> #+BEGIN_SRC sh :noweb yes
>>>> |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 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
>
>
>
>
--
Eric Schulte
http://cs.unm.edu/~eschulte/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Problem with noweb-ref property
2012-01-02 18:01 ` Eric Schulte
@ 2012-01-03 10:07 ` Andreas Leha
0 siblings, 0 replies; 6+ messages in thread
From: Andreas Leha @ 2012-01-03 10:07 UTC (permalink / raw)
To: emacs-orgmode
Eric Schulte <eric.schulte@gmx.com> writes:
>>>>
>>>> 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.
>>>>
>>
>> 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,
>
Hi Eric,
thanks for this quick-and-dirty fix ;-) Works great!
Cheers,
Andreas
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-01-03 10:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-29 19:13 Problem with noweb-ref property Tomas Grigera
2011-12-29 19:51 ` Eric Schulte
2011-12-29 23:16 ` Tomas Grigera
2012-01-02 12:32 ` Andreas Leha
2012-01-02 18:01 ` Eric Schulte
2012-01-03 10:07 ` Andreas Leha
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).