"Christopher M. Miles" <[email protected]> writes:

>>> The attached .org file works for me - I put requirements in a separate
>>> source block and I repeat the :var setting in the last src block.
>>>
>>> If you find an occurrence in other languages where the repeated setting
>>> is not needed, please give me an example.
>> ...
>> Indeed, so I guess this is not supported in Org Mode originally.
>>
>> Is it possible to support it? Or does it have a value to support?
>>
>> Well, the first obvious reason is to avoid repeated typing and redundant 
>> input
>> data.
>>
>> If this is not possible or very difficult to implement. I will not insist on
>> this. I guess we have other solution on Babel to archive same purpose. WDYT?
>>
>
> I found another related similar problem thread:
> - https://list.orgmode.org/87v8jaoz3u.fsf@localhost/
> - https://list.orgmode.org/[email protected]/
>
> Mark here.
>
> Ihor, what about the supporting progress?

I can see how including default or custom :var/:prologue/:epilogue in
noweb references can be useful. Not always though. Sometimes, it is
undesired.

I do not oppose adding :var expansion as an optional feature. It will
boil down to calling org-babel-expand-body:<lang>.

For the time being, we just have the following in the manual:

    [fn:50] In the following example, attempting to evaluate
    the second code block will give an error, because the variables
    defined in the first code block will not be defined in the second
    block.

    #+begin_example
    ,#+NAME: get-prompt
    ,#+BEGIN_SRC emacs-lisp :var prompt="root> " :var command="ls"
      (concat prompt command)
    ,#+END_SRC

    ,#+RESULTS: get-prompt
    : root> ls

    ,#+BEGIN_SRC emacs-lisp :noweb yes
      <<get-prompt>>
    ,#+END_SRC
    #+end_example

    The previous block is expanded without setting ~prompt~ and ~command~
    values.

    #+begin_example
    ,#+BEGIN_SRC emacs-lisp
      (concat prompt command)
    ,#+END_SRC
    #+end_example


-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to