* 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-exp.el (org-babel-exp-process-buffer): Fix error when
`org-confirm-babel-evaluate' is set to a function.
Thanks to Charles C. Berry for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/87403
* lisp/ob-exp.el (org-babel-exp-in-export-file): Instead of using the
headline text use the headline ID when one is present. This fixes a
bug in the resolution of code block headers in properties during
export when multiple headlines with the same name are present.
* lisp/ob-core.el: Add comment to forward declaration of
'org-src-preserve-indentations'.
* lisp/ob-exp.el: Require org-src to import
'org-src-preserve-indentations'.
* lisp/ob-haskell.el, lisp/ob-python.el: Remove superfluous forward
declaration of 'org-src-preserve-indentations', since it gets
imported by other requires.
* lisp/org.el (org-in-commented-heading-p): New function.
* lisp/ob-tangle.el (org-babel-under-commented-heading-p): Remove
function.
(org-babel-tangle-collect-blocks): Use new function.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Use new function.
* testing/lisp/test-org.el (test-org/in-commented-heading-p): New
test.
* 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.
This reverts commit 24812caff4. This is
a wrong fix sinc the function already calls `org-element-context',
which cannot find Babel code in macros anyway.
* 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.
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-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-exp.el (org-export-babel-evaluate): Add a 'inline-only option.
(org-babel-exp-results): Implement 'inline-only for
`org-export-babel-evaluate'.
* doc/org.texi (Exporting code blocks): Document the 'inline-only setting
for `org-export-babel-evaluate'.
This is useful because there is no way for inline results to be stored.
The imagined usecase is that all non-inline source blocks will be
evaluated manually by the user. Inline blocks, however, must be
evaluated during export, or they will be simply deleted by the exporter.
* lisp/ob-exp.el (org-babel-exp-results): Suppress user confirmation
of the emacs-lisp wrapper execution around a lob call.
* lisp/ob-lob.el (org-babel-lob-execute): Suppress user confirmation
of the emacs-lisp wrapper execution around a lob call.
* 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.
* lisp/ob-exp.el (org-export-blocks-preprocess): Pos can sometimes be
set to a value greater than start, because of indentation, and lead
to a search bound error.
* lisp/ob-exp.el (org-export-blocks-preprocess): Results of an
evaluated code block can be inserted within the blank lines after
the block. Hence, if the block has to be removed, delete everything
down to the first non-blank line after the end of block closing
string, instead of removing everything down to the very end of the
block.
* testing/lisp/test-ob-exp.el: Add test.
* lisp/ob-exp.el (org-babel-exp-non-block-elements): More accurate
white space handling when evaluating inline-src-block, babel-call and
inline-babel-call elements or objects. Also removed use of
`org-babel-examplize-region' since it would never be called anyway
(return value from `org-babel-exp-do-export' is never nil).
* lisp/ob-exp.el (org-export-blocks-preprocess): Improve blank lines
handling in function. Add comments. Remove
`org-export-blocks-postblock-hook' since it's defined nowhere
now (and doesn't need to, there's `org-export-before-parsing-hook'
already).
* lisp/org-exp-blocks.el: Delete file.
* lisp/ob-exp.el (org-export-blocks-preprocess): Moved from
"org-export-blocks.el".
* lisp/ob-ditaa.el (org-ditaa-jar-path): Moved from
"org-export-blocks.el".
* lisp/ob-exp.el (org-babel-exp-src-block): Remove unused argument.
(org-babel-exp-non-block-elements): Rewrite function using Org Element.
* lisp/org-exp-blocks.el (org-export-blocks-preprocess): Rewrite
function using Org Element.
* org.el (org-mode-map): Add keybindings to
`org-element-transpose' and `org-narrow-to-element'.
(org-metaup): Fall back on `org-element-drag-backward'.
(org-metadown): Fall back on `org-element-drag-forward'.
Also move chunks of declarations and require statements to
get rid of compiler warnings.
* org-exp-blocks.el (org): Don't require org. Add declarations.
* org-clock.el (org): Don't require org.
* ob-exp.el (org-list-forbidden-blocks): Add declarations.
* org.el (org-mode-map): Add keybindings to
`org-element-transpose' and `org-narrow-to-element'.
(org-metaup): Fall back on `org-element-drag-backward'.
(org-metadown): Fall back on `org-element-drag-forward'.
Also move chunks of declarations and require statements to
get rid of compiler warnings.
* org-exp-blocks.el (org): Don't require org. Add declarations.
* org-clock.el (org): Don't require org.
* ob-exp.el (org-list-forbidden-blocks): Add declarations.
This patch ensure Org-mode will build on all supported versions of
Emacs, after the renaming of the cl macros behind the cl- prefix in the
recent Emacs trunk.
* lisp/org-compat.el (org-flet): Compatibility function now that flet
has been removed from cl-macs.
(org-labels): Compatibility function now that labels has been removed
from cl-macs.
* lisp/ob-R.el (org-compat): Require org-compat.
* lisp/ob-comint.el: Require org-compat.
* lisp/ob-exp.el (org-babel-exp-do-export): Switch to compatibility
function.
* lisp/ob-gnuplot.el (org-babel-expand-body:gnuplot): Switch to
compatibility function.
* lisp/ob-lob.el (org-babel-lob-get-info): Switch to compatibility
function.
(org-babel-lob-execute): Switch to compatibility function.
* lisp/ob-python.el (org-babel-python-evaluate-session): Switch to
compatibility function.
* lisp/ob-ref.el (org-babel-ref-index-list): Switch to compatibility
function.
* lisp/ob-sh.el (org-babel-sh-var-to-string): Switch to compatibility
function.
* lisp/ob-tangle.el (org-babel-load-file): Switch to compatibility
function.
(org-babel-tangle): Switch to compatibility function.
(org-babel-spec-to-string): Switch to compatibility function.
* lisp/ob.el (org-babel-view-src-block-info): Switch to compatibility
function.
(org-babel-execute-src-block): Switch to compatibility function.
(org-babel-edit-distance): Switch to compatibility function.
(org-babel-switch-to-session-with-code): Switch to compatibility
function.
(org-babel-sha1-hash): Switch to compatibility function.
(org-babel-balanced-split): Switch to compatibility function.
(org-babel-join-splits-near-ch): Switch to compatibility function.
(org-babel-get-rownames): Switch to compatibility function.
(org-babel-format-result): Switch to compatibility function.
(org-babel-insert-result): Switch to compatibility function.
(org-babel-examplize-region): Switch to compatibility function.
(org-babel-merge-params): Switch to compatibility function.
(org-babel-noweb-p): Switch to compatibility function.
(org-babel-expand-noweb-references): Switch to compatibility function.
* lisp/org-bibtex.el (org-bibtex-headline): Switch to compatibility
function.
(org-bibtex-fleshout): Switch to compatibility function.
(org-bibtex-read): Switch to compatibility function.
(org-bibtex-write): Switch to compatibility function.
* lisp/org-exp-blocks.el (org-export-blocks-preprocess): Switch to
compatibility function.
* lisp/org-exp.el (org-export-format-source-code-or-example): Switch to
compatibility function.
* lisp/org-macs.el (org-called-interactively-p): Indentation fix.
* lisp/org-mouse.el (org-mouse-timestamp-today): Switch to compatibility
function.
(org-mouse-set-priority): Switch to compatibility function.
(org-mouse-popup-global-menu): Switch to compatibility function.
(org-mouse-context-menu): Switch to compatibility function.
* lisp/org-plot.el (org-plot/gnuplot-to-grid-data): Switch to
compatibility function.
(org-plot/gnuplot-script): Switch to compatibility function.
* lisp/org.el (org-entry-get): Switch to compatibility function.
(org-fill-paragraph): Switch to compatibility function.
(org-auto-fill-function): Switch to compatibility function.
* lisp/ob-exp.el (org-babel-exp-code): Escape all lines when exporting
Org-mode blocks.
* lisp/ob.el (org-babel-parse-src-block-match): Make use of the new
language argument to org-babel-strip-protective-commas.
(org-babel-parse-inline-src-block-match): Make use of the new
language argument to org-babel-strip-protective-commas.
(org-babel-strip-protective-commas): Now accepts a language
argument.
Conflicts:
lisp/ob-exp.el
* lisp/ob-exp.el (org-babel-exp-code): Escape all lines when exporting
Org-mode blocks.
* lisp/ob.el (org-babel-parse-src-block-match): Make use of the new
language argument to org-babel-strip-protective-commas.
(org-babel-parse-inline-src-block-match): Make use of the new
language argument to org-babel-strip-protective-commas.
(org-babel-strip-protective-commas): Now accepts a language
argument.
* lisp/ob-exp.el (org-babel-exp-src-block): Remove noweb handling from
the top level.
(org-babel-exp-code): Noweb handling for code export.
(org-babel-exp-results): Noweb handling for results export.
I started from the 78ec8e commit then cherry-picked and squashed
commits that have been done in master since then, except the bad
commits that overwrote the tree (in master) with the tree in maint.
This commit also bumps the version number to 7.8.06.
The only "fix" that was made between 78ec8e and the previous commit
is e0072f which has been reported to break stuff.
This fixes a wrong merge that should not have happened:
commit 7e903a merges the master branch into the maint branch,
while we really want to keep the maint branch a bugfix-only
branch.
This commit reverts back the maint branch to its state before
merging the master branch. From there, we will fix remaining
problems with the maint branch (e.g. copyright issues) then
release this maint branch as Org-mode 7.8.05.
* lisp/ob-exp.el (org-babel-exp-in-export-file,
org-babel-exp-src-block, org-babel-exp-inline-src-blocks): Allow
org-current-export-file to contain a buffer.
This allows to resolve references from a buffer not visiting any file
(i.e. a temporary buffer) during export process.
Conflicts:
lisp/ob-exp.el (org-babel-exp-in-export-file): Allow
org-current-export-file to contain a buffer name.
* lisp/ob-exp.el (org-babel-exp-call-line-template): Control export of
additional call line information.
(org-babel-exp-non-block-elements): Fancier call line export.
* testing/examples/babel.org (an): Example data to test new call line
export.
* testing/lisp/test-ob-exp.el (ob-exp/export-call-line-information):
Test new call line export.
* lisp/ob-exp.el (org-babel-exp-results): Alter a copy of info.
* testing/examples/babel.org (an): Example data for test behavior.
* testing/lisp/test-ob-exp.el (ob-exp/noweb-no-export-and-exports-both):
Confirm proper behavior.