From: tsd@tsdye.com (Thomas S. Dye)
To: Charles Berry <ccberry@ucsd.edu>
Cc: emacs-orgmode@gnu.org
Subject: Re: input data for babel blocks
Date: Tue, 01 Oct 2013 09:06:25 -1000 [thread overview]
Message-ID: <m1y56czu8e.fsf@poto.westell.com> (raw)
In-Reply-To: <loom.20131001T170542-940@post.gmane.org> (Charles Berry's message of "Tue, 1 Oct 2013 15:29:57 +0000 (UTC)")
Hi Chuck,
Neat. Thanks for sharing.
All the best,
Tom
Charles Berry <ccberry@ucsd.edu> writes:
> Alan Schmitt <alan.schmitt <at> polytechnique.org> writes:
>
>>
>> Hi Charles,
>>
>> ccberry <at> ucsd.edu writes:
>>
>> > Lacking that, another alternative to the approach you have crafted is to
>> > use elisp src blocks to set up the commands needed to create the
>> > objects,
>> > and then place the results of executing the elisp src block in the src
>> > block of your favored language using noweb, for example
>> >
>> > #+BEGIN_SRC mylang :noweb yes
>> > <<elisp-conversion-to-mylang("arg1","arg2")>>
>> > #+END_SRC
>> >
>> > might convert 'arg2' to an object of the desired type named 'arg1' in a
>> > 'mylang' src block.
>>
>> This looks like a very powerful approach, but it's a bit beyond my
>> understanding of babel (which is limited) and noweb (whose existence I
>> just discovered after reading http://orgmode.org/manual/noweb.html).
>>
>
> Sorry if it was a bit obtuse. The examples given by others seem to have
> helped. And I will give one more.
>
> [deleted]
>
>> If you have an example that uses different languages, I'd love to look
>> at it. I'll then try to write an example for ocaml.
>>
>
>
> Here is what I use for LaTeX thru elisp to R:
>
>
>
> * Quote Blocks
>
> quote-blks takes two args:
>
> - blk :: a string of comma separated src block names
> - sep :: an optional separator for use when there is more than one
> block
>
> I usually save it in a file and load it in with
> (org-babel-lob-ingest file). But you can copy and paste and the example
> below will still work.
>
> #+name: quote-blks
> #+BEGIN_SRC emacs-lisp :var blk="abc" :var sep="\"\n\""
> (save-excursion
> (replace-regexp-in-string "\"\"" ""
> (mapconcat
> (lambda (x)
> (org-babel-goto-named-src-block x)
> (format "%S" (cadr (org-babel-get-src-block-info t))))
> (split-string blk "," t)
> sep)
> t t))
>
> #+END_SRC
>
>
> * example of use
>
>
> The LaTeX here can be editted via C-c '
> (i.e. org-edit-special --> org-edit-src-code).
>
> #+name: lstuff
> #+BEGIN_SRC latex :eval never :exports none
> Here is a \backslash. And an unmatched quote: '.
> #+END_SRC
>
>
> Here is an example using it on the above block.
>
> The cat statement prints a formatted version. The str statement shows
> what R sees (but the outer quotes are not part of the string).
>
> #+BEGIN_SRC R :noweb yes :results output
> some.latex <-
> <<quote-blks("lstuff")>>
> cat(some.latex,"\n")
> str(some.latex)
> #+END_SRC
>
> #+RESULTS:
> : Here is a \backslash. And an unmatched quote: '.
> : chr "Here is a \\backslash. And an unmatched quote: '."
>
> HTH,
>
> Chuck
>
>
>
--
Thomas S. Dye
http://www.tsdye.com
next prev parent reply other threads:[~2013-10-01 19:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-30 12:50 input data for babel blocks Alan Schmitt
2013-09-30 16:26 ` Charles Berry
2013-10-01 0:08 ` Eric Schulte
2013-10-01 8:12 ` Alan Schmitt
2013-10-01 11:58 ` Eric Schulte
2013-10-01 13:01 ` Alan Schmitt
2013-10-01 14:29 ` Rick Frankel
2013-10-01 15:16 ` Alan Schmitt
2013-10-01 15:29 ` Charles Berry
2013-10-01 17:16 ` Alan Schmitt
2013-10-01 19:06 ` Thomas S. Dye [this message]
2013-10-01 0:04 ` Eric Schulte
2013-10-01 8:15 ` Alan Schmitt
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=m1y56czu8e.fsf@poto.westell.com \
--to=tsd@tsdye.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).