From: "Charles C. Berry" <ccberry@ucsd.edu>
To: "O.Hamann" <O.Hamann@gmx.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [babel] is there a chance to split arguments in src block calls or noweb syntax
Date: Sun, 31 Jan 2016 11:34:26 -0800 [thread overview]
Message-ID: <alpine.OSX.2.20.1601311116450.1553@charles-berrys-macbook.local> (raw)
In-Reply-To: <56ADC60F.5080404@gmx.net>
On Sun, 31 Jan 2016, O.Hamann wrote:
> Hi all,
>
> Splitting header arguments for source blocks into different lines works very
> fine,
> (and leads one to put more and more args in the header... )
>
> Is there a chance or trick to do similarly when calling such src blocks?
> Somehow like in shell scripts a backslash at the end of a line will signal
> continuation?
> (example see below)
>
> Any suggestions or workarounds or best-practices to make the call lines
> better readable and editable are welcome!
>
> Kind regards,
>
> Olaf
>
Try using a custom babel language. Then using variable assignment from
babel block.
Here I define `fundamental' as a language, which means I can edit src
blocks like `lorem' in a src edit buffer in fundamental mode without
needing to do more than execute the `define-fundamental-as-babel' block or
put that defun in my .emacs. And when I execute the lorem block - as when
it is used in `:var txt=lorem()' - it returns the body as a string.
#+NAME: define-fundamental-as-babel
#+BEGIN_SRC emacs-lisp
(defun org-babel-execute:fundamental (body params)
(format "%s" body))
#+END_SRC
#+NAME: lorem
#+BEGIN_SRC fundamental
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
#+END_SRC
#+NAME: abc
#+BEGIN_SRC emacs-lisp :results value :var txt="A B C"
(concat "txt-->" txt "<--txt")
#+END_SRC
#+CALL: abc( lorem() ) :results raw :wrap EXAMPLE
#+RESULTS:
#+BEGIN_EXAMPLE
txt-->Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<--txt
#+END_EXAMPLE
BTW, there is already `org-babel-execute:latex', which is very handy for
editing LaTeX and then handing it to a src block for further processing.
HTH,
Chuck
next prev parent reply other threads:[~2016-01-31 19:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-12 1:41 Noweb: Same function, two string results differ one with double-quotes the other without Grant Rettke
2016-01-31 8:30 ` [babel] is there a chance to split arguments in src block calls or noweb syntax O.Hamann
2016-01-31 19:34 ` Charles C. Berry [this message]
2016-02-05 7:49 ` O.Hamann
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=alpine.OSX.2.20.1601311116450.1553@charles-berrys-macbook.local \
--to=ccberry@ucsd.edu \
--cc=O.Hamann@gmx.net \
--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).