* lisp/ob-core.el (org-babel-view-src-block-info): when a property
value was numeric, an error was raised. Fixed by converting property
value to string before evauation.
* lisp/ob-core.el (org-babel-view-src-block-info): Add property string
"header args" to output of org-babel-view-src-block-info to make
debugging of header-args setting problems easier.
* lisp/ob-core.el (org-babel-view-src-block-info): Add property string
for language specific "header args:LANG" to output of org-babel-view-src-block-info to make
debugging of header-args setting problems easier.
* ob.core.el (org-babel-remove-inline-result): Removing an inline src
block result removes all whitespace preceding it. The function is
now `interactive'.
* ob-core.el (org-babel-insert-result): The call to
`org-babel-remove-inline-result' preceeds insertion of whitespace
and setting location of local variable `inlinep'.
Daniele Pizzolli reported that cleaning a buffer by evaluating
`org-babel-remove-inline-result' can leave unwanted whitespace. That
bug is fixed, and the function is made `interactive'.
* lisp/ob-core.el (org-babel-remove-inline-result): Delete results of
current inline src block or inline babel call if it is wrapped in a
"{{{results(.*)}}}" macro call.
* lisp/ob-core.el (org-babel-get-lob-one-liner-matches): Ensure that
the point ends up on the same line as, and just before, `call_'
before setting match-data.
* ob-core.el (org-babel-get-inline-src-block-matches): Use
`org-element-context' and friends to find inline-src-block. When
point is in an inline-src-block (including white space determined by
:post-blank) set match-data and return `t'.
* lisp/ob-core.el (org-babel-insert-result): Delete any `results'
macro following current inline src block or babel call; insert
current value in 'results' macro possibly wrapping RESULT in an
export snippet or inline source block first. Use of `:results list'
or `:results table', or use of a multiline RESULT (after stripping a
trailing newline) or a list RESULT from an inline src block or babel
call throws an error.
* lisp/ob-core.el (org-babel--script-escape-inner): New function.
(org-babel-script-escape): Use it.
* testing/lisp/test-ob.el (test-org-babel/script-escape): New test.
* lisp/ob-core.el (org-babel-get-inline-src-block-matches): Use
`org-looking-at-p' instead of `thing-at-point'.
The latter could give odd results depending on the syntax table. In
particular, for me (thing-at-point 'word) was returning src_foo in
this context.
* lisp/ob-core.el (org-babel-where-is-src-block-head): Refactor. In
particular, do not return a marker, ever. Also update docstring.
* testing/lisp/test-ob.el (test-ob/org-babel-remove-result--results-org):
Fix tests containing invalid Org syntax.
* lisp/ob-core.el (org-babel-map-src-blocks,
org-babel-map-inline-src-blocks): Make sure to ignore case when
looking for source blocks.
Reported-by: Christopher Genovese <genovese@cmu.edu>
<http://permalink.gmane.org/gmane.emacs.orgmode/93454>
* 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-common-header-args-w-values): Add
:output-dir'.
Otherwise tthis property is not inherited correctly from
subtree-/file-level properties.
* lisp/ob-core.el (org-babel-noweb-error-all-langs): Raise noweb
errors regardless of language.
(org-babel-expand-noweb-references): Make use of the new
`org-babel-noweb-error-all-langs' variable.
* 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.
* ob-core.el (org-babel-insert-result): Test all list elements against
listp and (eq element 'hline) instead of checking just the first.
org-babel table output uses different formatting for a list of lists,
but detects it incorrectly causing an error. An example of a block
causing an error is an emacs lisp source block containing just 1 line:
'((1) 2)
* ob-core.el (org-babel-demarcate-block): Upcase or downcase
the inserted #+begin_src and #+end_src depending on the
current case of #+begin_src and #+end_src.
Thanks to Alexander Baier for reporting this.
* lisp/ob-core.el (org-babel-generate-file-param): New function.
(org-babel-get-src-block-info): Use it.
(org-babel-merge-params): Handle :file-ext.
(org-babel-graphical-output-file): error if no :file or :file-ext.
* testing/lisp/test-ob.el (test-org-babel/file-ext-and-output-dir):
New test.
* doc/org.texi (Specific header arguments): Add doc for :file-ext and
:output-dir header args.
* lisp/ob-R.el (org-babel-expand-body:R): Don’t calculate
graphics-file.
(org-babel-execute:R): Only look for a graphics-file if needed.
* lisp/ob-core.el (org-babel-graphical-output-file): New generic function.
* lisp/ob-R.el (org-babel-R-graphical-output-file): Delete specific version.
(org-babel-expand-body:R): Use generic version.
* lisp/ob-maxima.el (org-babel-maxima-graphical-output-file): Delete
specific version.
(org-babel-maxima-expand): Use generic version.
* lisp/ob-octave.el (org-babel-octave-graphical-output-file): Delete
specific version
(org-babel-execute:octave): Use generic version.
* org.el (org-trim): Rewrite and make a defsubst.
* org-bibtex.el (org-bibtex-get): Use `org-trim' instead of
`org-babel-trim'.
* ob-core.el (org-babel-trim): Delete and alias to `org-trim'.
(org-babel-chomp): Delete and alias to `org-trim-trailing'.
(org-trim-trailing): New defsubst.
(org-babel-examplize-region): Fix version.
* ob-core.el (org-babel-remove-result-one-or-many): New function.
* ob-keys.el (org-babel-key-bindings): Add a keybinding for the
new function `org-babel-remove-result-one-or-many'.
TINYCHANGE
* 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.