org-mode/testing/examples/ob-header-arg-defaults.org
Nicolas Goaziou dbb375fdfc Simplify Babel calls evaluation
* lisp/ob-lob.el (org-babel-default-lob-header-args): Merge value with
  `org-babel-default-header-args' since this variable is meant to
  replace the latter.
(org-babel-lob-ingest): Make sure `org-babel-default-lob-header-args' is
used instead of `org-babel-default-header-args'.
(org-babel-lob--src-info): New function.
(org-babel-lob-get-info): Use new function.  Make return value
a replacement for `org-babel-get-src-block-info'.
(org-babel-lob-execute): Use `org-babel-execute-src-block' instead of
duplicating functionalities.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Apply changes to
  `org-babel-lob-get-info' return value.

* testing/examples/ob-header-arg-defaults.org:
* testing/lisp/test-ob-header-arg-defaults.el (test-ob-header-arg-defaults/tree/accumulate/call):
(test-ob-header-arg-defaults/tree/complex/call):
(test-ob-header-arg-defaults/tree/overwrite/call):
* testing/lisp/test-ob-lob.el (test-ob-lob/caching-call-line):
(test-ob-lob/named-caching-call-line): Update tests.

The purpose of this commit is to make Babel calls more
predictable (e.g., wrt property inheritance) and to remove code
duplication.  Also, Babel calls results are no longer treated as Emacs
Lisp values.
2016-06-16 23:15:01 +02:00

5.8 KiB
Raw Blame History

Tests for default header arguments to Babel source blocks

  (mapconcat (lambda (n)
               (let* ((n (string (+ 48 n)))
                      (p (intern (concat "t" n))))
                 (if (boundp p) (eval p) (concat "--" n))))
             (number-sequence 1 end)
             "/")

Global property

Global t1 t2 t3 t4 t5 t6 t7 t8 t9
var property go1 go2 go3
header-args gh1 gh2 gh4
header-args:emacs-lisp ge1 ge4 ge5
Result ge1 gh2 go3 ge4 ge5 6 7 8 9
<<showvar>>

Tree property

Overwrite

Global t1 t2 t3 t4 t5 t6 t7 t8 t9
var property go1 go2 go3
header-args gh1 gh2 gh4
header-args:emacs-lisp ge1 ge4 ge5
Tree t1 t2 t3 t4 t5 t6 t7 t8 t9
var property to6
header-args th7
header-args:emacs-lisp te8
Result #+CALL ge1 gh2 go3 ge4 ge5 to6 th7 te8 9
Result noweb 1 2 3 4 5 to6 th7 te8 9
<<showvar>>

Accumulate

Global t1 t2 t3 t4 t5 t6 t7 t8 t9
var property go1 go2 go3
header-args gh1 gh2 gh4
header-args:emacs-lisp ge1 ge4 ge5
Tree t1 t2 t3 t4 t5 t6 t7 t8 t9
var+ property to1 to6
header-args+ th2 th3
header-args:emacs-lisp+ te5
Result #+CALL ge1 th2 th3 ge4 te5 to6 7 8 9
Result noweb ge1 th2 th3 ge4 te5 to6 7 8 9
<<showvar>>

Complex

Global t1 t2 t3 t4 t5 t6 t7 t8 t9
var property go1 go2 go3
header-args gh1 gh2 gh4
header-args:emacs-lisp ge1 ge4 ge5
Tree t1 t2 t3 t4 t5 t6 t7 t8 t9
var property to1 to6
header-args+ th2
header-args:emacs-lisp te5
Result #+CALL gh1 th2 go3 gh4 te5 to6 7 8 9
Result noweb gh1 th2 3 gh4 te5 to6 7 8 9
<<showvar>>