* 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'.
Protect apostrophes not covered by the last backport. Convert
expressions like '(...) to \\='(...) and symbols written as 'name to
`name'. (In addition to ensuring the correct display, the latter also
improves consistency with many Org docstrings.)
If these aren't protected, Emacs 25 may display them as curved quotes in
the help buffer, depending on the value of text-quoting-style.
These changes are the combination of the commits below (in order
applied). Unlike other backports, these are applied in one commit
because they are closely related and because some of the later commits
reverse changes in earlier commits. Changes to message and help quote
display for Emacs 25 seem to be here to stay. The quote protections are
required to ensure grave accents and apostrophes are displayed as
intended in Emacs 25, and they should not affect earlier versions.
Quoting fixes in lisp/org
6cd2629bd1b3ce77d29ac28e29237c94a4197116
Paul Eggert
Mon Aug 31 00:29:40 2015 -0700
More-conservative ‘format’ quote restyling
fbb5531fa11d13854b274d28ccd329c9b6652cfc
Paul Eggert
Sun Aug 23 22:39:06 2015 -0700
Prefer directed to neutral quotes
875a5d0ead827d3da32ecbd30e739a29f07bbc87
Paul Eggert
Mon Aug 24 23:57:25 2015 -0700
Escape ` and ' in doc
19532d147b431a4fe34f088d6de07891c48e2c5c
Paul Eggert
Tue Sep 1 18:23:21 2015 -0700
Fix some more docstring etc. quoting problems
26bd978d87dfbf9baa115cd961a67d42b416c4bf
Paul Eggert
Thu Sep 3 15:32:54 2015 -0700
Go back to grave quoting in source-code docstrings etc.
6afef3f6ca2f3009c722b84e249903b7f807b044
Paul Eggert
Mon Sep 7 16:09:27 2015 -0700
Add changes from Emacs repo that should have been backported with
bb77dd2.
Update copyright year to 2015
7e09ef09a479731d01b1ca46e94ddadd73ac98e3
Paul Eggert
Thu Jan 1 14:26:41 2015 -0800
* lisp/org.el (org-link-search): Remove TYPE argument, used to force
`org-occur' or `org-do-occur' on fuzzy search. Instead, enclose string
within forward slashes.
* lisp/org-macro.el (org-macro-initialize-templates):
* lisp/ob-exp.el (org-link-search): Apply signature change.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Issue an error when a
src block with no language is processed.
Throw an error with an informative message when trying to export buffer
containing `#+src_block\n'.
Reported-by: XIE Yuheng <xyheme@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/95920>
* ob-exp.el (org-babel-exp-do-export): `clean' lambda form removes inline
results wrapped in `results{{{(' and `)}}}' by calling
`org-babel-remove-inline-result'.
* 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.