>  > I'm guessing you mean expand and not evaluate? When I hit "C-c C-c" on
both > of the blocks in your example, they are evaluated just fine.
>
> I think the issue arises if you evaluate the second block without having
already evaluated the first block. In that case, an error is signalled:
>
> let: Symbol’s function definition is void: goo
>
> Upon removing the COMMENT from the headline and repeating, it works. Of
course, if you evaluate the first block first, it works fine in either
scenario. So it seems, as Grant pointed out, the noweb reference is not
being resolved when the surrounding headline is commented.
>

You don't need to remove the COMMENT. All you have to do is evaluate both
blocks. COMMENT only blocks exporting and expansion. It has no effect on
evaluating.

Le dim. 28 juin 2026 à 20:14, Paul Bryan <[email protected]> a écrit :

> > I'm guessing you mean expand and not evaluate? When I hit "C-c C-c" on
> both > of the blocks in your example, they are evaluated just fine.
>
> I think the issue arises if you evaluate the second block *without*
> having already evaluated the first block. In that case, an error is
> signalled:
>
> let: Symbol’s function definition is void: goo
>
> Upon removing the COMMENT from the headline and repeating, it works. Of
> course, if you evaluate the first block first, it works fine in either
> scenario. So it seems, as Grant pointed out, the noweb reference is not
> being resolved when the surrounding headline is commented.
>
> I don't know the answer to whether this is intended or not, but at least I
> can say that I get the same behaviour.
>
> – *Paul*
>
> * From*: Earl Chase <earl+chase+%[email protected]%3E>
> * To*: Grant Shoshin Shangreaux
> <grant+shoshin+shangreaux+%[email protected]%3E>
> * Cc*: [email protected]
> * Date*: Sun, 28 Jun 2026 19:25:31 -0500
> * Subject*: Re: noweb expansion behavior in commented subheadings
>
> > I stumbled upon some confusing behavior today. I am working on a
> > literate program which is published as I push commits. Some sections are
> > commented out so the won't export while I am still working on them.
> >
> > I was trying to evaluate a source block that used some noweb expansion
> > and ran into an issue where my named block was not expanding as
> > expected. Eventually I realized it was because the section I am working
> > in is commented, and the source must be skipped during expansion.
> >
> > The following demonstrates the issue (assuming you don't already have a
> > symbol named goo defined)
> >
> > * COMMENT Test Commented NoWeb
> > #+name: goo
> > #+begin_src elisp
> >   (defun goo () (print "goo"))
> > #+end_src
> >
> > #+begin_src elisp :results output :noweb yes
> >   <<goo>>
> >   (goo)
> > #+end_src
> >
> > Is this the desired behavior? Is there a different approach to use
> > commented sections of an org-mode document while iterating with source
> > blocks?
> >
> > Thank you,
> > Grant
> >
>
> I'm guessing you mean expand and not evaluate? When I hit "C-c C-c" on
> both of the blocks in your example, they are evaluated just fine.
>
> Le dim. 28 juin 2026 à 16:05, Grant Shoshin Shangreaux
> <[email protected]> a écrit :
>
>>
>> I stumbled upon some confusing behavior today. I am working on a
>> literate program which is published as I push commits. Some sections are
>> commented out so the won't export while I am still working on them.
>>
>> I was trying to evaluate a source block that used some noweb expansion
>> and ran into an issue where my named block was not expanding as
>> expected. Eventually I realized it was because the section I am working
>> in is commented, and the source must be skipped during expansion.
>>
>> The following demonstrates the issue (assuming you don't already have a
>> symbol named goo defined)
>>
>> * COMMENT Test Commented NoWeb
>> #+name: goo
>> #+begin_src elisp
>>   (defun goo () (print "goo"))
>> #+end_src
>>
>> #+begin_src elisp :results output :noweb yes
>>   <<goo>>
>>   (goo)
>> #+end_src
>>
>> Is this the desired behavior? Is there a different approach to use
>> commented sections of an org-mode document while iterating with source
>> blocks?
>>
>> Thank you,
>> Grant
>>
>>
>>
>>
>>
>>

Reply via email to