* lisp/ob-exp.el (org-babel-exp-results): Use :eval instead of :export
since the function is used to evaluate a source block before
exporting it.
Reported-by: Alexandre Duret-Lutz <adl@lrde.epita.fr>
<http://lists.gnu.org/r/emacs-orgmode/2019-01/msg00226.html>
* lisp/ob-core.el (org-babel-sha1-hash): Add optional argument to
specify context.
(org-babel-execute-src-block): Use new argument.
* lisp/ob-exp.el (org-babel-exp-src-block): Use new argument.
(org-babel-exp-results): Fix context.
Reported-by: Ken Mankoff <mankoff@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-06/msg00117.html>
* lisp/ob-exp.el (org-babel-exp--at-source): Source blocks generated
by evaluating other source blocks may not be found in the original
buffer. In that case, do not move point.
Reported-by: "Berry, Charles" <ccberry@ucsd.edu>
<http://lists.gnu.org/r/emacs-orgmode/2017-12/msg00538.html>
* lisp/ob-exp.el (org-babel-exp-process-buffer): Change variable
name `org-export-babel-evaluate' to `org-export-use-babel'. Also
change the name in its `defcustom' and set the `:safe' key.
* lisp/ox-icalendar.el (org-icalendar-export-current-agenda): Change
variable name.
* lisp/ox.el (org-export-as): Change variable name.
* doc/org.texi (Exporting code blocks): Change variable name. Amplify
the explanation of what the variable does. Add variable index entry.
* testing/lisp/test-ob-exp.el: Change variable name.
* testing/lisp/test-ob-lob.el: Change variable name.
* testing/lisp/test-ox.el: Change variable name.
Users were often confused that setting this variable to `nil' will
cause header arguments to be ignored in addition to preventing code
from being evaluated. It is hoped that the documentation changes and
the name `org-export-use-babel' will better convey that everything
babel does can be switched off with this variable.
* lisp/ob-exp.el (org-export-babel-evaluate); Inform users that `:eval
never-export' should be used to avoid rerunning code on export.
Some users are puzzled when setting this variable to `nil' disables
all of babel.
The issue was raised by Ken Mankoff:
http://article.gmane.org/gmane.emacs.orgmode/107230
* lisp/ob-exp.el (org-babel-exp--at-source): New macro.
(org-babel-exp-in-export-file): Remove macro.
(org-babel-exp-src-block): Remove unused argument. Use new macro.
(org-babel-exp-process-buffer): Apply signature change above. Put
temporary properties on top of Babel code so as to find original
location without relying on heuristics.
(org-babel-exp-results): Use new macro.
Export process has to know context of Babel code being evaluated (e.g.,
so as to retrieve parameters from node properties). However, evaluating
previous code can drastically change the buffer. The library used some
heuristics to find the original location. Those are not necessary
anymore.
* 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.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Handle
`org-export-babel-evaluate' handling.
(org-babel-exp-results): Ignore `org-export-babel-evaluate' since it is
handled as a higher level.
* lisp/ox.el (org-export-as): Allow to short-circuit babel evaluation if
`org-export-babel-evaluate' is nil.
* testing/lisp/test-ob-exp.el (ob-export/babel-evaluate): New test.
Reported-by: Nicolas Richard <nrichard@ulb.ac.be>
<http://permalink.gmane.org/gmane.emacs.orgmode/106767>
* lisp/ob-lob.el (org-babel-lob-get-info): Make the function on par with
`org-babel-get-src-block-info' by providing the beginning position of
Babel code.
(org-babel-lob-execute):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
(org-babel-exp-results): Handle new data.
* lisp/ob-lob.el (org-babel-block-lob-one-liner-regexp):
(org-babel-inline-lob-one-liner-regexp):
(org-babel-lob-one-line-regexp):
* lisp/ob-core.el (org-babel-inline-src-block-regexp): Remove variables.
(org-babel-map-inline-src-blocks):
(org-babel-map-call-lines):
(org-babel-map-executables):
(org-babel-execute-buffer):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
(org-babel-exp-results): Do not use removed variables.
Babel now mostly uses the parser to handle Babel code. Regexps are not
needed anymore.
* lisp/ob-core.el (org-babel-get-src-block-info): Rewrite function.
Change signature.
(org-babel-parse-src-block-match):
(org-babel-parse-inline-src-block-match): Remove functions.
(org-babel-execute-src-block): Remove useless function call.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Make use of signature
change.
(org-babel-exp-results): Use new return value from
`org-babel-get-src-block-info'. Tiny refactoring.
* testing/lisp/test-ob.el (test-ob/nested-code-block): Fix test.
* contrib/lisp/org-eldoc.el (org-eldoc-get-src-lang): Use parser instead
of removed function.
* testing/examples/babel.org: Fix test environment.
* lisp/ob-exp.el (org-babel-in-example-or-verbatim): Remove function.
* testing/lisp/test-ob.el (test-ob/combining-scalar-and-raw-result-types):
Update test.
This function is unused and inaccurate. If needed, the parser should be
used instead.
* lisp/ob-core.el (org-babel-get-src-block-info): Do not return block
indentation.
(org-babel-parse-src-block-match): Ignore block indentation.
(org-babel-demarcate-block): Find appropriate indentation instead of
using the one from the original block.
(org-babel-where-is-src-block-result): Change signature. Indent
according to context instead of relying on indentation from original
block.
(org-babel-insert-result): Change signature.
(org-babel-check-confirm-evaluate):
(org-babel-execute-src-block):
(org-babel-insert-header-arg): Apply change to src-block info.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Apply change to
src-block info.
* lisp/ob-lob.el (org-babel-lob-get-info): Do not return indentation.
(org-babel-lob-execute): Apply change to lob-info.
Indentation from source block is often wrong at the block and its
results may not be in the same context.
* lisp/ob-core.el (org-babel-goto-named-src-block): Use parser instead
of `org-babel-lob-one-liner-regexp'.
* lisp/ob-lob.el (org-babel-lob-execute-maybe): Ignore spurious check,
now handled by the parser.
(org-babel-lob-get-info): Fully use parser. Accept a new optional
argument to avoid parsing the same location twice.
* lisp/ob-exp.el (org-babel-exp-process-buffer):
* lisp/ob-ref.el (org-babel-ref-resolve): Optimize call to
`org-babel-lob-get-info'.