emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [babel] is there a chance to split arguments in src block calls


From: Charles C. Berry
Subject: Re: [O] [babel] is there a chance to split arguments in src block calls or noweb syntax
Date: Sun, 31 Jan 2016 11:34:26 -0800
User-agent: Alpine 2.20 (OSX 67 2015-01-07)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]