#StackBounty: #org-mode #org-babel org-babel-tangle with function in header arguments

Bounty: 50

Following this suggestion, I have a function to automatically generate figure names:

#+begin_src emacs-lisp :exports none
(set (make-local-variable 'i) 0)
(fset (make-local-variable 'fig-file)
      #'(lambda () (concat "f" (number-to-string (incf i)) ".pdf")))

I apply it to R code as shown below.

#+begin_src R :file (fig-file) :results output graphics :exports results
(plot (rnorm(10))

This works well, except when I try org-babel-tangle on the org file, I get this error: eval: Symbol’s function definition is void: fig-file.

How can I get org-babel-tangle to work with functions in the header arguments?

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.