Ihor Radchenko writes:
> Amy Grinn writes:
>
>> Here is a simple way to implement this feature.
>
> Since you are adding a new feature, it should have (1) test coverage;
> (2) be documented in the manual; (3) be announced in etc/ORG-NEWS.
Thank you for the tips, will do!
Amy Grinn writes:
> I kinda disagree with your reasoning but I agree with your conclusion.
> I think it would be strange for third party or user configuration to
> parse the value of a noweb header argument directly. Org provides a
> lublic api for this which should be backwards compatible:
>
>
Ihor Radchenko writes:
> :noweb yes <<< >>> is actually backwards-incompatible. Consider
> third-party code that makes assumptions about possible values of
> :noweb
> header argument. If third-party code does a check like
> (equal noweb-value "yes"), the new syntax can break such code.
I kinda d
Amy Grinn writes:
> Here is a simple way to implement this feature.
> ...
> -(defun org-babel-noweb-wrap (&optional regexp)
> +(defun org-babel-noweb-wrap (&optional regexp info)
>"Return regexp matching a Noweb reference.
>
> Match any reference, or only those matching REGEXP, if non-nil.
Amy Grinn writes:
> To expand on this, some major modes can fundamentally conflict with the
> default noweb syntax. Here is a valid shell script *and* a valid noweb
> reference to a block named EOF:
>
> cat <> file.txt
> Hello
> EOF
>
> I hope this helps explain why the wrap-start and wrap-end o
Amy Grinn writes:
>> Org mode does not _currently_ modify the code. But that's actually wrong
>> - things like escaped ,* or indentation sometimes also stay on the way
>> and produce incorrect fontification. So, rewriting the fontification of
>> src blocks to cleanup the code before fontification
Amy Grinn writes:
> Ihor Radchenko writes:
>
>> Amy Grinn writes:
>>
>>> I would like to add support for setting 'org-babel-noweb-wrap-start and
>>> 'org-babel-noweb-wrap-end for each src block individually
>>
>> May you please explain the use case when changing the default values
>> is useful?
Ihor Radchenko writes:
> Amy Grinn writes:
>
>> How much does org mode modify the fontification for an indirect buffer?
>> Without having looked into it, I assume not much or at all.
>> ... I think
>> that approach could be more complex, especially when dealing with a
>> theoretically infinite n
Amy Grinn writes:
>> This sounds like XY problem then.
>> If the real problem you want to solve is fontification, we may instead
>> adjust Org mode fontification of source blocks to exclude noweb
>> references.
>
> I see a problem with multiple possible solutions, some more involved
> than others
Ihor Radchenko writes:
> Amy Grinn writes:
>
#+name: firewall
#+begin_src sh :noweb yes :noweb-start <<< :noweb-end >>>
>>>
>>> May you please explain the use case when changing the default values
>>> is useful?
>>
>> Of course! Changing the default values can be useful to prevent sy
Amy Grinn writes:
>>> #+name: firewall
>>> #+begin_src sh :noweb yes :noweb-start <<< :noweb-end >>>
>>
>> May you please explain the use case when changing the default values
>> is useful?
>
> Of course! Changing the default values can be useful to prevent syntax
> highlighting errors in a spe
Ihor Radchenko writes:
> Amy Grinn writes:
>
>> I would like to add support for setting 'org-babel-noweb-wrap-start and
>> 'org-babel-noweb-wrap-end for each src block individually using the
>> header args :noweb-start and :noweb-end:
>> ...
>> #+name: firewall
>> #+begin_src sh :noweb yes :now
Amy Grinn writes:
> I would like to add support for setting 'org-babel-noweb-wrap-start and
> 'org-babel-noweb-wrap-end for each src block individually using the
> header args :noweb-start and :noweb-end:
> ...
> #+name: firewall
> #+begin_src sh :noweb yes :noweb-start <<< :noweb-end >>>
May y
Amy Grinn writes:
> I would like to add support for setting 'org-babel-noweb-wrap-start and
> 'org-babel-noweb-wrap-end for each src block individually using the
> header args :noweb-start and :noweb-end:
Here's another possible syntax we could use:
:noweb [wrap-start] [wrap-end]
#+name: mess
suarezmigu...@icloud.com writes:
> #+name: getClientInstanceNameNew
> #+begin_src shell :session something :var connection="admin@10.0.3.149" :var
> client="example_client" :var apacheDir="/etc/apache/vhosts"
> <>
> client=$client
> apacheDir=$apacheDir
> grep $client $apacheDir/*
> #+end_src
>
>
Wow, works!, thank you very much.
Now, I have a more specific example.
#+name: initSSH
#+begin_src shell :var connection=“admin@10.0.3.200" :noweb yes
ssh -t miguel@172.28.3.249 "sudo -u admin ssh -t $connection 'sudo su'"
#+end_src
#+name: getClientInstanceNameNew
#+begin_src shell :session som
suarezmigu...@icloud.com writes:
> I use heavily org-mode for Literate DevOps, so I have a lot of shell commands
> that connect through SSH and do some things later, for example:
>
> #+name: initSSH
> #+begin_src shell :var connection=“admin@somehost"
> ssh -t miguel@host "sudo -u someuser ssh -t
Hello Ken, thank you for your message,
After reading the very interesting get_property function, I found that even
though I will probably use it for some cases, it doesn’t apply directly, to my
case.
For more examples, if I have 1 source code block:
>> #+name: greeting
>> #+begin_src sh :var n
Hi,
I'm not sure that I understand your issue or needs from the provided examples,
but I wonder if the example I provide here would be helpful. It bypasses :var
an lets you inject a PROPERTY value anywhere. It is also language agnostic. You
can use it to execute commands (that are set as PROPER
Hi Łukasz,
One workaround that is fairly reliable is to prefix the names
of the blocks to be nowebbed with an &. So #+name: block-name
becomes #+name: &block-name. Then you reference it as
<<&block-name>> and the heredoc syntax is broken. Best,
Tom
Immanuel Litzroth writes:
> You can set the delimiters used for noweb code.
> org-babel-noweb-wrap-end and org-babel-noweb-wrap-end.
>
> I think I set them to @@ in shell code.
I almost always use {{{...}}} via a footer in my org-files:
# Local Variables:
# org-babel-noweb-wrap-start: "{{{"
#
You can set the delimiters used for noweb code.
org-babel-noweb-wrap-end and org-babel-noweb-wrap-end.
I think I set them to @@ in shell code.
Immanuel
On Thu, Nov 25, 2021 at 7:41 PM Łukasz Stelmach wrote:
>
> Hi,
>
> Is there anything I may try to stop shell syntax hihgliting in code
> blocks
Hi Immanuel,
Immanuel Litzroth writes:
> You can choose which delimiters signal noweb.
> see the documentation of org-babel-noweb-wrap-start and
> org-babel-noweb-wrap-end.
Thank you! That indeed should make my problem solvable in a perfect
way.
Best wishes
Sebastian
You can choose which delimiters signal noweb.
see the documentation of org-babel-noweb-wrap-start and
org-babel-noweb-wrap-end.
Immanuel
On Mon, Mar 22, 2021 at 5:35 PM Sebastian Miele
wrote:
>
> Hello!
>
> The noweb syntax seems to clash with the syntax of here documents in
> shell scripts. In
George Mauer writes:
> I would like noweb to expand during eval but *not* tangle. Is this possible?
>
> I realize I can achieve the same effect with multiple code blocks but it
> seems an odd asymmetry to not be able to do this directly.
>
> Is it possible and just not documented?
It is indeed
"Fraga, Eric" writes:
> My approach to this is to create three blocks that are tangled and a
> separate block (or more than one if you have different tests you want to
> perform) for evaluation that references those three blocks (via noweb)
> but is not tangled.
That works, but shouldn't Nuno's
Nuno Salgado writes:
> My question was to figure out what's the point to tangle the code
> without substituition!
Your imagination is the limit. E.g. this could be useful to document
the ":noweb eval" behavior opposed to ":noweb yes".
My approach to this is to create three blocks that are tangled and a
separate block (or more than one if you have different tests you want to
perform) for evaluation that references those three blocks (via noweb)
but is not tangled.
--
Eric S Fraga via Emacs 28.0.50, Org release_9.3.1-94-g0ac6a9
Marco,
Thank you for your help. I read it again and didn't find. But no
problem.
My question was to figure out what's the point to tangle the code without
substituition!
NS
Marco Wahl writes:
> Nuno Salgado writes:
>
>> Vars definition:
>> #+NAME:DEFVARS
>>
>> #+BEGIN_SRC shell :tang
Diego,
Thank you for your help.
Yes, I want the scripts to be all in one file in order to execute them
all. But it's nice do execute then individualy (C-c C-c) to test and debug.
I think I have to have 2 blocks of code for each script: one for tangle,
with no <> and another to test, with <> and
Hi Nuno,
":noweb eval" means that noweb references are only expanded during
evaluation of the code, but not during export. This is why you get the
literal <> references in exported output. Here are the possible
values of :noweb and what they mean: https://orgmode.org/manual/noweb.html
Also note t
Nuno Salgado writes:
> Vars definition:
> #+NAME:DEFVARS
>
> #+BEGIN_SRC shell :tangle yes
> v1=1;
> v2=2;
> #+END_SRC
>
> Script1:
>
> #+BEGIN_SRC shell :tangle yes :noweb eval
> <>
> echo $v1;
> #+END_SRC
>
> This works great when I do C-c C-c in each script.
>
> B
Hi Sebastian,
On 2019-11-24 at 22:24 -08, Sebastian Miele wrote...
> there is the possibility to give a common name to multiple blocks via
> the header arg :noweb-ref. That works in the way you looking for.
Yes this does what I want. I once knew but then forgot about this. Thank you
for remindi
Hi Ken,
Ken Mankoff writes:
> When tangling blocks, I can tangle multiple blocks by setting a
> (sub)-tree level property, or ":tangle foo" in multiple headers. Is
> there a way to achieve the same thing with noweb?
>
> I've tried giving multiple blocks the same "+name:" and then <>,
> but only
34 matches
Mail list logo