Re: noweb-start and noweb-end header args

2024-03-07 Thread Amy Grinn
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!

Re: noweb-start and noweb-end header args

2024-03-07 Thread Ihor Radchenko
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: > >

Re: noweb-start and noweb-end header args

2024-03-07 Thread Amy Grinn
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

Re: noweb-start and noweb-end header args

2024-03-07 Thread Ihor Radchenko
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.

Re: noweb-start and noweb-end header args

2024-03-07 Thread Ihor Radchenko
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

Re: noweb-start and noweb-end header args

2024-03-07 Thread Ihor Radchenko
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

Re: noweb-start and noweb-end header args

2024-03-06 Thread Amy Grinn
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?

Re: noweb-start and noweb-end header args

2024-03-06 Thread Amy Grinn
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

Re: noweb-start and noweb-end header args

2024-03-06 Thread Ihor Radchenko
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

Re: noweb-start and noweb-end header args

2024-03-06 Thread Amy Grinn
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

Re: noweb-start and noweb-end header args

2024-03-06 Thread Ihor Radchenko
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

Re: noweb-start and noweb-end header args

2024-03-06 Thread Amy Grinn
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

Re: noweb-start and noweb-end header args

2024-03-06 Thread Ihor Radchenko
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

Re: noweb-start and noweb-end header args

2024-03-05 Thread termux
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

Re: Noweb Function's body without evaluation

2023-04-04 Thread Ihor Radchenko
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 > >

Re: Noweb Function's body without evaluation

2023-04-03 Thread suarezmiguelc
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

Re: Noweb Function's body without evaluation

2023-04-02 Thread Ihor Radchenko
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

Re: Noweb Function's body without evaluation

2023-03-16 Thread suarezmiguelc
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

Re: Noweb Function's body without evaluation

2023-03-15 Thread Ken Mankoff
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

Re: noweb and shell heredocs

2021-11-30 Thread Tom Gillespie
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

Re: noweb and shell heredocs

2021-11-30 Thread Dr. Arne Babenhauserheide
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: "{{{" #

Re: noweb and shell heredocs

2021-11-25 Thread Immanuel Litzroth
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

Re: noweb syntax clashing with shell here document syntax

2021-03-23 Thread Sebastian Miele
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

Re: noweb syntax clashing with shell here document syntax

2021-03-22 Thread Immanuel Litzroth
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

Re: noweb expansion when eval and not tangle?

2021-02-19 Thread Timothy
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

Re: noweb

2020-01-23 Thread Nick Dokos
"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

Re: noweb

2020-01-22 Thread Marco Wahl
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".

Re: noweb

2020-01-22 Thread Fraga, Eric
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

Re: noweb

2020-01-22 Thread Nuno Salgado
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

Re: noweb

2020-01-22 Thread Nuno Salgado
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

Re: noweb

2020-01-22 Thread Diego Zamboni
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

Re: noweb

2020-01-22 Thread Marco Wahl
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

Re: noweb multiple block together

2019-11-25 Thread Ken Mankoff
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

Re: noweb multiple block together

2019-11-24 Thread Sebastian Miele
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