* lisp/ob-core.el (org-babel-exp-reference-buffer): New variable, as
a replacement for `org-current-export-file'.
(org-babel-check-confirm-evaluate): Use new variable.
* lisp/ob-exp.el (org-babel-exp-in-export-file): Use new variable.
(org-babel-exp-get-export-buffer): Remove function.
(org-babel-exp-process-buffer): Change signature.
* lisp/ob-ref.el (org-babel-ref-resolve): Use new variable during
export in order to properly resolve references.
* lisp/ox.el (org-export-execute-babel-code): Use new variable.
* contrib/lisp/org-wikinodes.el (org-wikinodes-process-links-for-export):
Remove a cond branch as it is always
false (`org-current-export-file' couldn't be a string).
* testing/lisp/test-ob-lob.el (test-ob-lob/export-lob-lines): Update
test.
* testing/lisp/test-ob.el (test-ob/eval-header-argument): Update test.
* testing/lisp/test-ob-exp.el (ob-export/reference-in-post-header):
New test.
During export, Babel executes sequentially all blocks in the buffer
being exported. This can lead to modifications preventing some
references from being resolved. As a workaround, Babel stores
a pristine copy of the buffer in a variable so it can always find
needed references.
Before this patch, the variable storing this copy was
`org-current-export-file' and was dynamically bound in "ox.el". It
was used to resolve noweb references (`org-babel-expand-noweb-references')
but not regular references (`org-babel-ref-resolve').
Now, the variable is `org-babel-exp-reference-buffer' and it is bound
from `org-babel-exp-process-buffer'. It is used to resolve all
references. In particular, this allows to use references in :post
header.
Thanks to Jarmo Hurri for reporting it.
* ob-core.el (org-babel-insert-result): Use `org-babel-examplify-region'.
(org-babel-capitalize-examplize-region-markers): Rename to
`org-babel-capitalize-example-region-markers'.
(org-babel-examplize-region): Mark obsolete and rename to
`org-babel-examplify-region'.
* lisp/ob-core.el (org-babel-current-result-hash): Additional info
argument so that named call line results may be found.
(org-babel-set-current-result-hash): Additional info argument so
that named call line results may be found.
* lisp/ob-lob.el (org-babel-lob-execute): Passing info to hash finding
functions so that named results may be found.
The bulk of the new code in org-babel-sha1-hash is borrowed from
org-babel-expand-src-block.
* lisp/ob-core.el (org-babel-sha1-hash): Expanded noweb references
when calculating hashes.
* org.el (org-babel-do-in-edit-buffer): Declare.
(org-babel-load-file, org-insert-comment)
(org-comment-or-uncomment-region): Don't require 'ob-core.
(org-mode-map): Remap `comment-dwim' to `org-comment-dwim'.
(org-comment-dwim): New command.
* ob-core.el (org-babel-do-in-edit-buffer): Make an autoload.
See http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00154.html
for a discussion about this bug.
* lisp/ob-C.el (org-remove-indentation): Declare function to appease
compiler.
* lisp/ob-core.el (org-remove-indentation): Declare function to
appease compiler.
* lisp/ob-fortran.el (org-remove-indentation): Declare function to
appease compiler.
* lisp/ob-C.el (org-babel-C-execute): Remove common indentation when
trimming.
* lisp/ob-core.el (org-babel-read-result): Remove common indentation
when trimming.
(org-babel-update-block-body): Remove common indentation when
trimming.
* lisp/ob-fortran.el (org-babel-execute:fortran): Remove common
indentation when trimming.
* lisp/ob-tangle.el (org-babel-process-comment-text): Better default
to process tangled comments.
* lisp/ob-core.el (org-babel-execute-src-block): Set location info
parameter for inline src blocks.
(org-babel-get-src-block-info): Set location info parameter for
inline src blocks.
This fixes a bug noticed by Rick Frankel in which two subsequent
#+call: lines will both update the same results. Before this commit
both of the following call lines would update the same result.
#+name: call-me
#+BEGIN_SRC emacs-lisp :var v="nil"
v
#+END_SRC
#+call: call-me("one")
#+call: call-me(v="two")
#+RESULTS:
: one
Now both lines are given their own result.
#+name: call-me
#+BEGIN_SRC emacs-lisp :var v="nil"
v
#+END_SRC
#+call: call-me("one")
#+RESULTS:
: one
#+call: call-me(v="two")
#+RESULTS:
: two
* lisp/ob-core.el (org-every): Declared function for compiler.
(org-babel-safe-header-args): Moved before first use.
(org-babel-header-args-safe-fn): Moved before first use.
Always call org-confirm-babel-evaluate from the head of the code
block being evaluated so that the info may be found with
e.g., (org-babel-get-src-block-info 'light)
* lisp/ob-core.el (org-babel-check-confirm-evaluate): Call
org-confirm-babel-evaluate from code block head.
* lisp/ob-core.el (org-babel-insert-header-arg): Optional arguments
for usage from Emacs Lisp programs. In addition this function will
now insert header arguments in the correct place instead of at the
current point.
This patch is based off of a request and an initial patch supplied by
Daniele Pizzolli.
* lisp/ob-core.el (org-babel-remove-result): Added an option to keep
the results keyword when removing the content of results.
* lisp/ob-core.el (org-babel-default-header-args): It is likely that
someone meant to set :padlines to "yes", but accidentally set
:padnewlines to "yes". Either way lets just remove this which
shouldn't have any functional effect.
Thanks to Rick Frankel for help debugging this problem.
* lisp/ob-core.el (org-babel-merge-params): When merging parameters, if
a variable is replaced with a new value, then delete colnames/rownames
for the original value of that variable.
* lisp/ob-core.el (org-babel-check-confirm-evaluate): Return result of
evaluating the function pointed to by`org-confirm-babel-evaluate'
when it is a functionp and its value as a variable otherwise.
This fixes a regression introduced in 5fe486807e and restores the fix
applied earlier in 8d272b0d3b (and then replaced by a cond form in
ece347e32c, which later got factored out again).