* 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).
* lisp/ob-core.el (org-babel-find-named-result): Call lines are not
results.
(org-babel-where-is-src-block-result): Don't implicitly name the
results of call lines.
* lisp/ob-exp.el (org-babel-exp-non-block-elements): There is now
another element on the call line info list.
* lisp/ob-lob.el (org-babel-lob-get-info): Return the name (if any)
at the end of the info list.
(org-babel-lob-execute): Pass the name through to execution.
* lisp/ob-core.el (org-babel-get-rownames),
lisp/org-table.el (org-table-transpose-table-at-point): Replace the
inadvertent use of mapcar* (from cl) by plain mapcar and direct cons
manipulation.
The error was not caught at compilation time since both source files
require cl during compilation for using cl macros. These were the
only uses of mapcar* in Org, but I didn't check for other cl
_functions_ (as opposed to macros, which would need to be checked if
their implementation uses cl functions).
* lisp/ob-core.el (org-babel-execute-src-block): Ensure that the
location is set before anything else is done.
* lisp/ob-ref.el (org-babel-ref-parse): Evaluate Emacs Lisp values in
header arguments at the location of the original code block.
* testing/lisp/test-ob.el (test-ob/location-of-header-arg-eval): Test
defending the new header argument evaluation behavior.
* lisp/ob-core.el (org-babel-params-from-properties): Use
`org-babel-current-src-block-location' for evaluating new-style
header-argument properties. Remove superfluous save-match-data
clauses. Comment which properties get evaluated where.
* lisp/ob-gnuplot.el (org-babel-expand-body:gnuplot): Use new header
arguments.
* lisp/ob-core.el (org-babel-common-header-args-w-values): Mention new
header arguments.
(org-babel-expand-body:generic): Use new header arguments.
* doc/org.texi (Specific header arguments): Document new header
arguments.
* lisp/ob-core.el (org-babel-read-result): More robust matching of
examplized ranges.
(org-babel-result-end): More robust matching of examplized ranges.
The `org-babel-params-from-properties' command was calling
`org-babel-merge-params', the output of which was then being fed back
to another call to `org-babel-merge-params'. The merge params
function is not designed to allow this form of recursive calling, and
as a result many variables were being set to empty values.
The first noticed side effect of this bug was the breakage of the
org-babel-load-file command, which relies on default header
arguments (namely :tangle), which were overwritten by the bug above.
The fix involved having the `org-babel-params-from-properties'
function return a list of alists, which may then all be handed to the
top-level merge-params call.
* lisp/ob-core.el (org-babel-params-from-properties): Now returns a list
of alists and does *not* call `org-babel-merge-params'.
(org-babel-parse-src-block-match): Handle new list of lists output of
`org-babel-params-from-properties'.
(org-babel-parse-inline-src-block-match): Handle new list of lists
output of `org-babel-params-from-properties'.
* lisp/ob-exp.el (org-babel-exp-src-block): Handle new list of lists
output of `org-babel-params-from-properties'.
(org-babel-exp-non-block-elements): Handle new list of lists output of
`org-babel-params-from-properties'.
* lisp/ob-lob.el (org-babel-lob-execute): Handle new list of lists
output of `org-babel-params-from-properties'.
* lisp/ob-core.el (org-babel-insert-header-arg,
org-babel-parse-src-block-match): Replace `if' with empty else part
by `when' for readability. (org-babel-params-from-properties):
Inquire for language specific and default header properties.
Language specific header properties take precedence over default
header properties and old-style header property specifications.
This allows for header arguments to be specified as
properties (including inheritance).
#+PROPERTY: header-args :cache "no"
#+PROPERTY: header-args:R :session "*R-property*"
:PROPERTIES:
:header-args: :cache "yes"
:header-args:R: :session "*R-drawer*"
:END:
* doc/org.texi (Top): Documentation for new tangle-mode header argument.
(Specific header arguments): Documentation for new tangle-mode header
argument.
(rownames): Documentation for new tangle-mode header argument.
(tangle-mode): Documentation for new tangle-mode header argument.
* lisp/ob-core.el (org-babel-common-header-args-w-values): Adding the
new :tangle-mode header argument.
(org-babel-read): Read values starting with a "#" character as emacs
lisp.
* lisp/ob-tangle.el (org-babel-tangle): Use the new :tangle-mode header
argument.
* lisp/org-pcomplete.el (pcomplete/org-mode/block-option/src): Use the
new :tangle-mode header argument.
* lisp/ob-core.el (org-babel-where-is-src-block-head): return
point-marker instead of point.
(org-babel-current-exec-src-block-head): new global variable which is
bound during `org-babel-execute-src-block-maybe'
(org-babel-get-src-block-info): return a list of 7 elements, last
being the header location
Evaluation backends might need to use the exact location of the block in
original org file. For example when inserting the correct source
references for visual debugging. With this patch the information on
current block is available in `org-babel-current-exec-src-block-head'.
* lisp/ob-core.el (org-babel-parse-inline-src-block-match),
lisp/ob-exp.el (org-babel-exp-src-block): Give header arguments from
properties priority over default header arguments.
The previous commit e79e8943de did fix this only in
ob-core.el (org-babel-parse-src-block-match). It was already correct
in ob-lob.el (org-babel-lob-execute).
* lisp/ob-core.el (org-babel-inline-result-wrap): Defcustom controlling
the wrapping of inline results.
(org-babel-examplize-region): Use new defcustom controlling the
wrapping of inline results.
* org-agenda.el (org-agenda-write):
* ob-core.el (org-babel-expand-src-block): Use
`org-called-interactively-p'.
Thanks to Jason L Wright for reporting this.