From: Joon Ro <joon.ro@outlook.com>
To: "Charles C. Berry" <ccberry@ucsd.edu>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Using property values in source code blocks
Date: Sat, 16 Jul 2016 12:00:29 -0500 [thread overview]
Message-ID: <COL125-W1501A9815D1DC5E802467EEB340@phx.gbl> (raw)
In-Reply-To: <alpine.OSX.2.20.1607160829390.570@charles-berrys-macbook.local>
[-- Attachment #1: Type: text/plain, Size: 1552 bytes --]
> I do not see an easy way to do what you want only with tangle.
>
> There are hooks you can define that might enable you to set things up.
> Maybe you can use `org-babel-pre-tangle-hook' to collect the property
> values and put them somewhere that `org-babel-post-tangle-hook' can get at
> them and use them to modify the tangled results accordingly. Or maybe
> `org-babel-post-tangle-hook' can do it by using methods like those in
> `org-babel-detangle' to look back at the *.org file.
>
> Another alternative is to write all of your code blocks so they will
> execute to create the code you want as results and then tangle those
> results. You would use :wrap like this:
>
> --8<---------------cut here---------------start------------->8---
>
> #+BEGIN_SRC shell :noweb yes :wrap "src shell :tangle ./tangle-test.sh"
> echo "echo " <<get-property(prop="DUMMY",pom=(point))>>
> #+END_SRC
>
> --8<---------------cut here---------------end--------------->8---
>
> Execute the src block and then tangle the buffer.
>
> In fact, if you go that route it might make more sense to write elisp
> code blocks to find the prpoerty values and then format the results.
>
I see - thank you so much for your help. It does look like I have to write some code to do this.
Since I'm not that familiar with elisp, I think I will write a Python code block which has the template as a multi-line string, and then just pass values as arguments to the source code block to generate the shell scripts.
Best,Joon
[-- Attachment #2: Type: text/html, Size: 2108 bytes --]
prev parent reply other threads:[~2016-07-16 17:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-06 4:10 Using property values in source code blocks Joon Ro
2016-07-06 17:36 ` Charles C. Berry
2016-07-06 20:03 ` Joon Ro
2016-07-06 23:05 ` Charles C. Berry
2016-07-07 3:50 ` Joon Ro
2016-07-07 15:48 ` Charles C. Berry
2016-07-07 15:53 ` Joon Ro
2016-07-15 23:38 ` Joon Ro
2016-07-15 23:44 ` Joon Ro
2016-07-16 2:05 ` Charles C. Berry
2016-07-16 2:47 ` Joon Ro
2016-07-16 16:02 ` Charles C. Berry
2016-07-16 17:00 ` Joon Ro [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=COL125-W1501A9815D1DC5E802467EEB340@phx.gbl \
--to=joon.ro@outlook.com \
--cc=ccberry@ucsd.edu \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).