* lisp/ob-exp.el (org-babel-exp-process-buffer): Signal user-error
with an informative message rather than letting
org-babel-exp-do-export call fail due to an invalid INFO argument.
* testing/lisp/test-ob-exp.el (ob-exp/unknown-call-reference): Add
test.
Reported-by: Greg Minshall <minshall@umich.edu>
Ref: https://orgmode.org/list/628738.1616259666@apollo2.minshall.org
* lisp/ob-core.el (org-babel-use-quick-and-dirty-noweb-expansion):
Remove variable.
(org-babel-expand-noweb-references): Update function.
* doc/org.texi (noweb-ref): Document new behaviour.
(Noweb reference syntax): Delete reference to removed variable.
`org-babel-use-quick-and-dirty-noweb-expansion' main use is to speed
up Noweb expansion when expanding only by name. By distinguishing
name and reference expansion, we no longer need this variable. In the
first case, the expansion is quicker anyway, and in the second case,
we most certainly need an accurate expansion.
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-headers):
(test-ob-exp/org-babel-exp-src-blocks/w-no-file): Fix test.
These tests fail when "htmlize" is not available on the machine.
* 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-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>
* test/examples/babel.org: Miscellaneous fixes for new inline src
block schema. Return a scalar to avoid unwanted error. Return a raw
result from `src_emacs-lisp' to make checking results cleaner than
dealing with `results' macro.
* testing/lisp/test-ob-exp.el: Wrap some expected results in
`{{{results(' and ')}}}' and drop `=%s=' formatting of others.
* testing/lisp/test-ob-lob.el: Wrap some expected results in
`{{{results(' and ')}}}'.
* testing/lisp/test-ob.el: Wrap some expected results in `{{{results('
and ')}}}'.
* testing/lisp/test-ob.el
(test-org-babel/org-babel-get-inline-src-block-matches,
test-org-babel/inline-src_blk-results-silent): Tests of inline src
block matches (and `org-ctrl-ctrl-c') conform to the `:begin' and
`:end' properties of `org-element-context'.
* testing/lisp/test-ob.el
(test-org-babel/inline-src_blk-default-results-replace-line-1,
test-org-babel/inline-src_blk-default-results-replace-line-2):
Inline results are self replacing.
* testing/examples/babel.org: Change spaces to dashes in #+name
lines.
* testing/lisp/test-ob-exp.el (org-test-with-expanded-babel-code):
(ob-exp/evaluate-all-executables-in-order):
(ob-exp/exports-inline-code):
(ob-exp/exports-inline):
(ob-exp/exports-inline-code-double-eval):
(ob-exp/exports-inline-code-eval-code-once):
(ob-exp/exports-inline-code-double-eval-exports-both):
(ob-exp/use-case-of-reading-entry-properties):
(ob-exp/export-from-a-temp-buffer):
(ob-export/export-with-results-before-block):
(ob-export/export-under-commented-headline):
* testing/lisp/test-ob-lob.el (test-ob-lob/export-lob-lines):
* testing/lisp/test-ob.el (test-org-babel/inline-src_blk-default-results-replace-line-1):
(test-org-babel/inline-src_blk-default-results-replace-line-2):
(test-org-babel/inline-src_blk-manual-results-replace):
(test-org-babel/inline-src_blk-results-scalar):
(test-org-babel/inline-src_blk-results-verbatim):
(test-org-babel/inline-src_blk-preceded-punct-preceded-by-point):
* testing/lisp/test-ox.el (test-org-export/export-scope):
Bind ‘org-babel-inline-result-wrap’ and/or ‘org-export-babel-evaluate’
so tests work when users have customized these variables.
* testing/lisp/test-ob-exp.el (ob-export/export-with-results-before-block):
Add ‘org-trim’ where an extra newline was creeping in.
* testing/lisp/test-ob-lob.el (test-ob-lob/call-with-header-arguments):
Neutralize org-babel-insert-result, which was stomping on the buffer
contents and disrupting the test
* testing/lisp/test-org-element.el (test-org-element/block-switches):
Replace (should (and ...)) with multiple (should ...). This gives
more precise indications of what is wrong when a test fails.
(test-org-element/link-parser): Require org-docview.
* testing/lisp/test-org-timer.el (test-org-timer/other-timer-error):
Add the error type for ‘should-error’.
* testing/lisp/test-ox.el (test-org-export/set-title):
(test-org-export/handle-options):
(test-org-export/with-timestamps):
(test-org-export/comment-tree):
(test-org-export/handle-inlinetasks): Let
‘org-export-filter-body-functions’ and
‘org-export-filter-final-output-functions’ to nil where an empty
string is the expected result. ‘org-export-filter-apply-functions’
treats an empty string as special, and changes it to nil. This
creates test failures when the user has customized these variables.
* testing/org-test.el (org-test-with-temp-text): Let ‘org-mode-hook’
to nil.
(org-test-table-target-expect): Require ert since this function calls
some of its should* functions.
* lisp/ob-exp.el (org-babel-exp-inline-code-template): New
customizable variable to export inline source code (similar to
`org-babel-exp-code-template').
(org-babel-exp-code): New `type' argument to differentiate between
inline and standard code blocks.
* lisp/ob-core.el (org-babel-inline-src-block-regexp): Allow empty set
of switches and header arguments as in "src_sh[]{echo foo;}". Also
permit spaces before them.
* testint/lisp/test-org-element.el
(test-org-element/inline-src-block-parser): Test extended syntax for
inline source code.
* testing/lisp/test-ob-exp.el (ob-exp/exports-inline-code): New
function for testing inline source code handling. Also add three new
failing tests exhibiting unexpected results with ":results code"
switches.
* testing/lisp/test-ob.el
(test-org-babel/org-babel-get-inline-src-block-matches): Test for
inline source blocks with empty header arguments.
* testing/examples/babel.org: New sections for testing (i) exported
inline source code (used by `ob-exp/exports-inline-code'); (ii)
parsing inline source blocks with empty header arguments (used by
`test-org-babel/org-babel-get-inline-src-block-matches').
Until now pieces of inline source code were handled as standard code
blocks during export. These changes enable them to be exported.
* 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.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Skip code under
a commented headline.
* testing/lisp/test-ob-exp.el (ob-export/export-under-commented-headline):
New test.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Also check
`org-src-preserve-indentation' to know when to preserve indentation.
* testing/lisp/test-ob-exp.el (ob-export/export-and-indentation): New
test.
Thanks to John Hendy for reporting it.
* lisp/ob-exp.el (org-babel-exp-code-template): Include switches in
template.
(org-babel-exp-code): Provide %switches placeholder.
* testing/lisp/test-ob-exp.el (ob-export/export-src-block-with-switches):
New test.
(ob-export/export-src-block-with-flags): Fix indentation.
This fixes dde6af3a62. The confusion
came from the fact that "flags" placeholder had two meanings:
the :flags value and the block's switches (e.g., "-n"). This patch
separates these two meanings.
* lisp/ob-exp.el (org-babel-exp-code): Fix export of src blocks with
flags.
* testing/lisp/test-ob-exp.el (ob-export/export-src-block-with-flags):
New test.
Thanks to Giuseppe Lipari for reporting it.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Make processing more
robust when results are inserted before source block or when source
block is followed by multiple blank lines.
* testing/lisp/test-ob-exp.el (ob-export/export-with-results-before-block):
Add test.
* testing/examples/babel.org(use case of reading entry properties):
Adapt to use the new introduced #+NAME for src block calls.
* testing/lisp/test-ob-exp.el(ob-exp/use-case-of-reading-entry-properties):
Adapt to use the new introduced #+NAME for src block calls.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Renamed from
`org-export-blocks-preprocess'.
* lisp/ox.el (org-export-execute-babel-code): Apply previous renaming.
* testing/org-test.el (org-test-at-id): Make sure the function returns
the value of the last form in its body.
* testing/lisp/test-ob-exp.el: Fix tests.
* testing/lisp/test-ob-lob.el: Fix tests.