Commit Graph

423 Commits

Author SHA1 Message Date
Ihor Radchenko fc80d052db
Re-implement org-element-cache and add headline support
* lisp/org-element.el (org-element-with-disabled-cache): New macro.

(org-element-greater-elements): Add new org-data element.  It
functions like a virtual headline containing the whole buffer.  The
org-data properties are like headlie properties, but according to the
top-level drawer.  org-data's category is the buffer's category as
defined by top-level property drawer, #+CATEGORY keyworsd, and the
buffer file name.

(org-element--cache-element-properties, org-element-set-element): New
variable containing properties to be transferred when updating changed
element in cache in `org-element-set-element'.

(org-element--get-node-properties): Allow parsing node propreties in
top-level drawer when new optional argument is passed.  Respect
PROPERTY+ syntax.

(org-element--get-global-node-properties): New function.  It returns
node properties for top-level property drawer.

(org-element-org-data-parser, org-element-org-data-interpreter):
Implement the new org-data element.

(org-element-headline-parser, org-element-section-parser): Add new
:robust-begin and :robust-end
properties delimiting safe changes that do not modify headline
element.

(org-element--list-struct): Fix cache update when adding a headline
inside list.

(org-element--current-element): Implement cache support.  Record
parsing mode (:mode) and parsing granularity (:granularity) in the
element properties.

(org-element-parse-buffer, org-element--next-mode): Support new
org-data element.

(org-element--parse-elements): Record parsing granularity in the
returned tree

(org-element-use-cache): Enable cache by default.

(org-element-cache-persistent): New variable controlling cache
persistance across sessions.  Enabled by default.

(org-element--cache-self-verify,
org-element--cache-self-verify-frequency,
org-element--cache-diagnostics, org-element--cache-map-statistics,
org-element--cache-map-statistics-threshold,
org-element--cache-diagnostics-level,
org-element--cache-diagnostics-ring,
org-element--cache-diagnostics-ring-size): New variables controlling
cache diagnostics and self-diagnostics.  Greatly simplifies cache
debugging.

(org-element--cache, org-element--cache-sync-requests,
org-element--cache-sync-timer): Make cache buffer-local by default.

(org-element--headline-cache): Implement separate cache storing only
headlines and inlinetasks.

(org-element--cache-size, org-element--headline-cache-size): New
variables containing cache sizes.  This is much faster than
`avl-tree-size'.

(org-element--cache-sync-requests): Update docstring explaning the
request list structure.

(org-element--cache-sync-keys-value): New variable replacing
`org-element--cache-sync-keys' hash table.  The hash table was not
reliable because it was using elements as keys.  Upon any cached
element update/shift, the keys were invalidated making cache ordering
incorrect and breaking the cache badly.  Now, the cache keys are
stored as :org-element--cache-sync-key element property and the new
variable stores marker value indicating the current sync request
cycle.  See `org-element--cache-key' for more details.

(org-element--cache-change-tic): New variable controlling buffer
modification count that is registered in cache.  This variable allows
catching "stealth" edits.

(org-element--cache-non-modifying-commands): New variable listing
commands that will not be slown down if we fill cache on the fly.

(org-element--request-key, org-element--request-beg,
org-element--request-end, org-element--request-offset,
org-element--request-parent, org-element--request-phase): New macros.
They improve code readability (especially when using nameless-mode).

(org-element--format-element, org-element--cache-log-message,
org-element--cache-warn): New macros implementing generic logging
functionality.

(org-element--cache-key): Add section and org-data element support.
Change cache key storage from hash map to :org-element--cache-sync-key
element property + `org-element--cache-sync-keys-value'.  We use the
latter to group all the cache keys during a single cache request
sequence.  Once sync request is fully complete, the
`org-element--cache-sync-keys-value' is updated making all the old
sync keys obsolete (they will still be store as element properties).

(org-element--headline-cache-root): New function returning headline
cache root.

(org-element--cache-active-p): Prevent cache updates when
`inhibit-modification-hooks' is non-nil, unless non-nil optional
argument is provided.

(org-element--cache-find): Share cache between indirect buffers and
the base buffer.  We have to do it because after-change hooks for
indirect buffer are not called in the base buffer and vice versa.  Add
support for section and org-data elements.

(org-element--cache-put): Implement new approach for cache key
storage.  Add diagnostics.  Indicate cached elements using :cached
element property.  Support cache size calculation.

(org-element--cache-remove): Invalidate parent contents when removing
element.  Support cache size calculation.  Detect cache corruption due
to misordered elements.

(org-element--cache-shift-positions): Support :robust-begin and
:robust-end element properties.

(org-element--cache-sync): Add diagnostics.  Add detailed comments.
Prevent slowdown when large cache chunks need to be deleted forcing
O(N) complexity cutoff.  In phase 2, fix cases when next request
contains deleted cache key.  In phase 2, fix scenario when newly
inserted element intersects with existing elements in cache.  In phase
2, detect obsolete parents removed from cache.

(org-element--open-end-p): New function checking if an element can
have blank lines right after its :contents-end.

(org-element--parse-to): Do not alter match data.  Process complex
parsing mode changes correctly.  Support headlines in cache.  Support
org-data parsing.  Add detailed comments.  Add diagnostics.

(org-element--cache-sensitive-re): Make list lines sensitive.

(org-element--cache-change-warning): Update docstring.  Now, the
variable can have t, nil, and number values.  Numbers are used to
provide more details about changed headlines.

(org-element--cache-before-change, org-element--cache-after-change):
Handle headline hierarchy.  Properly handle cache in indirect
buffers.

(org-element--cache-after-change): Update docstring clarifying the
return values.  Add special handling for headline and org-data
elements updating them in-place instead of removing together with the
whole contents when possible.  Use :robust-begin/:robust-end element
properties to detect robust changes.

(org-element--cache-submit-request): Add detailed comments.  Correctly
handle cache in indirect buffers.  Delegate element modifications to
`org-element--cache-for-removal'.

(org-element--cache-verify-element): New function for cache
self-verification.

(org-element--cache-persist-before-write,
org-element--cache-persist-before-read,
org-element--cache-persist-after-read): Implement cache persistance.

(org-element-cache-reset): Correctly handle cache in indirect
buffers.  Support cache persistance.  Support new cache size
calculation and new cache key schema.

(org-element-cache-map): New function analagous to `org-element-map',
but much faster.  The function overperforms org-ql written by Adam
Porter aka alphapapa [1] and reuses some ideas from there (namely,
fast element skipping via regexps).

[1] https://github.com/alphapapa/org-ql/

(org-element-at-point): The returned elements are now guaranteed to
have correct parents up to org-data.  New optional argument
CACHED-ONLY limits element search to current cache---if element is not
in cache and current command is not in cache
`org-element--cache-non-modifying-commands', the cache is not updated
and the function returns nil.  Also, support cache verification.

(org-element-at-point-no-context): New function.  It is analogous of
older `org-element-at-point' with no guarantee that :parent properties
are correct beyond direct parent heading.  This function does not
update cache and can be useful when cache updates should be avoided
for performance reasons.

* lisp/ob-core.el (org-babel-where-is-src-block-result): Support
section and org-data elements in cache.

* lisp/org-macro.el (org-macro-replace-all,
org-macro--find-keyword-value): Support org-element-cache.

* lisp/org-table.el (orgtbl-to-generic): Support org-element-cache.

* lisp/org.el (org-mode): Add cache persistance.

(org-up-element): Preserve old behaviour when error is returned for
section and org-data element.

*
testing/lisp/test-org-archive.el (test-org-archive/update-status-cookie):
Fix test when cache is active.

* testing/lisp/test-org-colview.el (test-org-colview/columns-update):
Fix test.

* testing/lisp/test-org-element.el (test-org-element/extract-element):
Add suport for new org-data element.

* testing/lisp/test-org-element.el (test-org-element/parent-property):
Fix equality check.  Parents returned by cache and `org-element-map'
may not be `eq' now.  Just `equal'.

* testing/lisp/test-org-element.el (test-org-element/context): Support
section and headline parents.
2021-10-16 23:22:18 +08:00
Bastien 80b2aa41e1 Fix 1d5e41d41 2021-09-29 14:17:04 +02:00
Bastien 1d5e41d41b lisp/ob-core.el (org-babel-eval-headers): Fix elements ordering
* lisp/ob-core.el (org-babel-eval-headers): Fix elements ordering.
(org-babel-merge-params): Tiny refactoring.

This fixes the test `test-ob-lob/call-with-header-arguments' that
fails after 9f1507bdd.
2021-09-29 14:05:10 +02:00
Bastien 806ac1b7f6 *el: Fix indentation 2021-09-29 09:22:47 +02:00
Matt Huszagh 9f1507bdd1 ob-core.el: Add ability to use closures as default header arguments
* lisp/ob-core.el (org-babel-default-header-args): Document ability to
use closures.
(org-babel-eval-headers): New function to generate header arguments,
which adds the ability to evaluate closures during source block
execution or export.
(org-babel-merge-params): Only evaluate closures when we have our
final list of headers.
2021-09-29 09:19:05 +02:00
Bastien a5e8dfaf5b Revert "ob-core.el: Add ability to use closures as default header arguments"
This reverts commit 78783f4e47.
2021-09-29 09:18:48 +02:00
Kyle Meyer 41f76092c6 ob-core: Make recent change compatible with older Emacs versions
* lisp/ob-core.el (org-babel-disassemble-tables): Avoid length> for
compatibility with Emacs versions before 28.

length> and friends were added to Emacs in 0f790464d5 (Add new
predicates for sequence lengths, 2020-12-27), which hasn't yet made it
into a release.
2021-09-26 23:24:23 -04:00
Bastien 69850c1e88 ob-core.el (org-babel--file-desc): Remove unused condition
* lisp/ob-core.el (org-babel--file-desc): Remove unused condition.
2021-09-26 14:44:21 +02:00
Ihor Radchenko 54c2327f3a Allow :var header args to be assigned to cons cells
* lisp/ob-core.el (org-babel-disassemble-tables,
org-babel-gnuplot-process-vars): Use `proper-list-p' check instead of
`listp'.
(org-babel-disassemble-tables): Check list length before trying to
remove hline from a table assignment.
* testing/lisp/test-ob.el (test-ob/cons-cell-as-variable): Add the
test.
2021-09-26 10:21:20 +02:00
Matt Huszagh 78783f4e47 ob-core.el: Add ability to use closures as default header arguments
* lisp/ob-core.el (org-babel-default-header-args): Document ability to
use functions.
(eval-default-headers): New function to generate default header
arguments, which adds the ability to evaluate function arguments at
runtime.
(org-babel-get-src-block-info): Use new header argument evaluate
function when retreiving src block info.

* lisp/ob-exp.el (org-babel-exp-src-block): Must use new
eval-default-headers when exporting as well.

The closures are evaluated at runtime.
2021-09-26 10:13:38 +02:00
Stefan Kangas 51cdd6e30f Various minor docfixes found by checkdoc 2021-09-16 21:24:59 +02:00
Yasushi SHOJI 18bc3a65b2
ob-core: Document the option 'none' for :results handling
The commit d4b739fbf2 added the "none" header argument but didn't
add it to the `org-babel-insert-result' documentation string.  Put it
in the doc string so that users can discover it.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2021-08-31 21:40:51 +08:00
Tom Gillespie c9dfed48a6
ob-core: tangle check LOB after current buffer
* lisp/ob-core.el (org-babel-expand-noweb-references): Fix order when
searching for named babel blocks so that blocks in the current buffer
are always found first. This fixes a bug where stale versions of
blocks that have been ingested into the library of babel were being
preferentially tangled instead of newly modified versions from the
current buffer.
2021-07-25 03:42:42 +08:00
Nicolas Goaziou 62c90bef35 compat: Add `org-string-distance'
* lisp/ob-core.el (org-babel-edit-distance): Rename function
`org-string-distance' and move it to "org-compat.el".
(org-babel-check-src-block): Use `org-string-distance' instead.
* lisp/org-compat.el: Add `org-string-distance' for a future
deprecation in favor of `string-distance'.
2021-05-05 17:54:36 +02:00
TEC b90b850ae8 ob-core: Remove LaTeX environment #+results type
* lisp/ob-core.el (org-babel-result-end): Alloow the result to end
into a LaTeX environment.

By adding latex-enviroment to the possible results types, a much
richer experience is possible for backends that can produce
LaTeX-formatted maths as their results (for example: Calc, Julia with
Latexify, Python with SymPy, Octave with symbolic). This is superior
to a LaTeX export block as LaTeX environments can be (1) rendered
inline, and (2) better used in non-LaTeX export formats (e.g. HTML
with MathJax).  Without this, backends can output a LaTeX environment,
but new results will be added in front instead of replacing the
environment.
2021-05-01 13:03:09 +02:00
Kyle Meyer e0fb2339f4 Merge branch 'km/from-emacs-master'
Porting from Emacs's master to Org's maint branch has been on hold
leading up to the Emacs 27.2 release to avoid any required fixup syncs
carrying those commits into the emacs-27 branch.  This merge brings
those changes into master.  The km/from-emacs-master branch should be
merged to maint when Emacs 27.2 has been released (assuming Org 9.5
hasn't been released, in which case maint will be tracking 9.5.x and
already include these changes).
2021-02-14 18:06:23 -05:00
Stefan Monnier 7dd1cfb6ca Backport commit f8dbefbaa from Emacs
* lisp/ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Use `declare`.

* lisp/ob-core.el (org-babel-map-src-blocks): Use `declare`.
(org-babel-result-cond): Simplify edebug spec.

* lisp/org-clock.el (org-with-clock-position, org-with-clock):
* lisp/org-agenda.el (org-agenda-with-point-at-orig-entry):
* lisp/ob-tangle.el (org-babel-with-temp-filebuffer): Use `declare`.

Use `declare` instead of `def-edebug-spec` in most places
f8dbefbaa59bb17dd4a2dfa4d9ff560c46785792
Stefan Monnier
Fri Feb 12 16:08:01 2021 -0500
2021-02-14 17:38:07 -05:00
Mattias Engdegård 4c934424d6 Backport commit 46394dff7 from Emacs
* lisp/ob-core.el (org-babel--string-to-number): Put hyphen last in
alternative.
* lisp/org-agenda.el (org-agenda-filter): Escape '+' correctly.

Follow good regexp practice
46394dff7f01e7fe4af06a6c344e151af5c3eef4
Mattias Engdegård
Fri Dec 18 14:35:09 2020 +0100
2021-02-14 17:38:04 -05:00
Kyle Meyer 291993888d Merge branch 'maint' 2021-01-01 15:02:10 -05:00
Kyle Meyer 99eafe3787 Update copyright year to 2021 2021-01-01 14:59:01 -05:00
Kyle Meyer 3f1c044441 ob-core: Drop redundant Edebug specification list
* lisp/ob-core.el (org-babel-result-cond): Don't set specification
list with def-edebug-spec because it is already defined with a debug
declaration.
2020-11-06 00:49:07 -05:00
Matt Huszagh d9884cfa70 lisp/ob-core.el: Allow passing empty vector to :file-desc to omit description
* doc/org-manual.org (Type): Document empty vector argument for
file-desc.
* etc/ORG-NEWS (New argument for ~file-desc~ babel header): Add entry
to NEWS.
* lisp/ob-core.el (org-babel--file-desc): Add new function to evaluate
file description value.
(org-babel-execute-src-block): Correctly evaluate file description
when executing src block.
(org-babel-insert-result): Correctly evaluate file description value
when inserting the result of src block execution into the buffer.
* testing/lisp/test-ob.el (test-ob/file-desc-header-argument): Add
test case for new behavior.
2020-10-06 23:13:12 -04:00
Kyle Meyer 469ee63401 ob-core: Fix handling of multiple noweb refs in same line
* lisp/ob-core.el (org-babel-expand-noweb-references): Don't anchor
noweb regexp at start of line to allow multiple matches per line.
* testing/lisp/test-ob-tangle.el (ob-tangle/multiple-noweb-in-line):
Add test.

This fixes a regression introduced by c1aed9f80 (ob-core: Refactor
`org-babel-expand-noweb-references', 2020-01-12), which was part of
the 9.4 release.

Reported-by: Tom Gillespie <tgbugs@gmail.com>
Ref: https://orgmode.org/list/CA+G3_PO2yO1jMMpdrkc39BGQQ2eU5X4FzTEJVotjDJo-50dsqQ@mail.gmail.com
2020-09-15 23:45:16 -04:00
Bastien 15a6836e4f ob-core.el: Fix `org-babel--string-to-number'
* lisp/ob-core.el (org-babel--string-to-number): Exclude strings
not matching "^[0-9-e.+ ]+$" from being interpreted as numbers.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
https://orgmode.org/list/CAFyQvY14iek+op12Vm7+jrniGEVU2yha7kuPtNtFQAso6d=PjQ@mail.gmail.com/
2020-09-06 22:41:21 +02:00
Bastien f0a9677d90 ob-core.el: Silence byte-compiler 2020-09-06 11:27:11 +02:00
Kyle Meyer d4f48821c1 Merge branch 'maint' into master 2020-09-05 23:41:50 -04:00
Kyle Meyer e535da6e4f ob-core: Avoid duplicate body expansion logic
* lisp/ob-core.el (org-babel--expand-body): New function.
(org-babel-check-confirm-evaluate):
(org-babel-execute-src-block): Use org-babel--expand-body.

As of 727c6d7fe (lisp/ob-core.el: org-babel-check-confirm-evaluate
strip coderefs, 2020-09-04), org-babel-check-confirm-evaluate and
org-babel-execute-src-block use the same logic to expand the body and
strip coderefs.  Move that code to a helper function.

This patch is functionally equivalent to the patch originally proposed
by Tom Gillespie at
https://orgmode.org/list/CA+G3_PNi3uMvBiWgBdKuC3C6VJt1T1j-RKH43LRqYbr+4NS8ZA@mail.gmail.com
2020-09-05 23:39:08 -04:00
Tom Gillespie 3e1c0b0f44 lisp/ob-core.el: org-babel-check-confirm-evaluate strip coderefs
* lisp/ob-core.el (org-babel-check-confirm-evaluate): strip coderefs
before passing the body of the block to org-confirm-babel-evaluate
using the same let block as is used in org-babel-execute-src-block.
2020-09-05 23:38:35 -04:00
Bastien 479e09a8e2 Merge branch 'maint' 2020-09-05 16:41:03 +02:00
Ihor Radchenko f45591630f ob-core.el: Use `buffer-base-buffer' where needed
* lisp/ob-core.el (org-babel-result-to-file): Use
`buffer-base-buffer' so that `buffer-file-name' returns correct
results in indirect buffers too.

See <https://orgmode.org/list/87eeos3w7v.fsf@localhost>

TINYCHANGE
2020-09-05 16:40:45 +02:00
Kyle Meyer 7bc18ebbed ob-core: Avoid table conversion warning for empty results
* lisp/ob-core.el (org-babel-import-elisp-from-file): Don't try to
convert empty file to a table.
* testing/lisp/test-ob.el (test-ob/import-elisp-from-file): Add tests.

If org-babel-import-elisp-from-file is called with an empty file
(which many ob- libraries do when there are no results), feeding that
to org-table-import leads to a beginning-of-buffer error.  Before
14878f3f9 (ob-core: Display warning on failure to read results,
2020-05-21), this error was hard to notice because, after catching it,
it was reported as a quickly buried message.  After that commit, it is
displayed as a warning, which is not appropriate for the common and
unproblematic case of empty results.

Avoid the warning by only doing the table conversion if the file has
content.  Another option would be to do the table conversion but add a
beginning-of-buffer arm to the surrounding condition-case.  However,
that risks swallowing other sources of that error.

Reported-by: Colin Baxter <m43cap@yandex.com>
<https://orgmode.org/list/878se3nhbj.fsf@yandex.com>
2020-09-01 00:02:49 -04:00
John Herrlin ea946353aa ob-core: file-mode option in source code block arguments
* ob-core.el (org-babel-execute-src-block): Source code block header
argument `:file-mode' can set file permissions if `:file' argument is
provided.
(org-babel-common-header-args-w-values): Add `:file-mode' to common
header arguments.

TINYCHANGE
2020-08-02 22:59:25 -04:00
Kyle Meyer a103f3f3ee Merge branch 'maint' 2020-08-02 22:56:03 -04:00
Kyle Meyer df5a836375 ob-core: Call org-confirm-babel-evaluate with expanded noweb refs
* lisp/ob-core.el (org-babel-check-confirm-evaluate): Expand noweb
references in the body passed to org-confirm-babel-evaluate.
* testing/lisp/test-ob.el (test-ob/check-eval-noweb-expanded): New
test.

When noweb references are set to be expanded for evaluation,
org-confirm-babel-evaluate should receive the expanded body so that it
can make its decision based on what actually will be evaluated
(without resorting to calling org-babel-get-src-block-info itself).

Note that this results in up to three calls to
org-babel-expand-noweb-references.  Possible ways to avoid this are
discussed at the thread referenced below.

Reported-by: Tom Gillespie <tgbugs@gmail.com>
https://orgmode.org/list/CA+G3_PNi3uMvBiWgBdKuC3C6VJt1T1j-RKH43LRqYbr+4NS8ZA@mail.gmail.com/
2020-08-02 22:55:16 -04:00
stardiviner 758b039c04 fix 5f0a9cca3 missing space
* lisp/ob-core.el (org-babel-demarcate-block): Replace wrong newline
with missing space.
2020-06-01 15:50:19 +02:00
Bastien 5f0a9cca3d lisp/ob-core.el: Use lower-case by default for block keywords
* lisp/ob-core.el (org-babel-demarcate-block): Use lower-case
by default.
2020-05-25 11:51:57 +02:00
Kyle Meyer 14878f3f9a ob-core: Display warning on failure to read results
* lisp/ob-core.el (org-babel-import-elisp-from-file): Show handled
errors with display-warning rather than a message because the latter
is quickly overridden by subsequent messages, making it difficult if
not impossible for the user to spot.

The scope of the save-window-excursion call would need to be reduced
for the display-warning buffer to be shown, but nothing appears to
change the window configuration, so just drop the
save-window-excursion call.

Reported-by: Greg Minshall <minshall@umich.edu>
<2449663.1588516024@apollo2.minshall.org>
2020-05-24 11:56:43 -04:00
Nicolas Goaziou c76bacc483 ob: Ignore RESULTS keyword case
* lisp/ob-core.el (org-babel-current-result-hash):
(org-babel-hide-hash):
(org-babel-hide-all-hashes):
(org-babel-result-hide-all):
(org-babel-hide-result-toggle-maybe):
(org-babel-hide-result-toggle):
(org-babel--clear-results-maybe):
(org-babel-remove-result): Bind `case-fold-search' to t before looking
for `org-babel-result-regexp'.
2020-05-13 18:13:18 +02:00
Nicolas Goaziou 89c759f3ad ob: Replace angle brackets with parenthesis in Babel hashes
* lisp/ob-core.el (org-babel-hash-show-time): Remove
unnecessary :version keyword.
(org-babel-result-regexp):
(org-babel--insert-results-keyword): Remove angle brackets from time
stamp in hash.
* testing/lisp/test-ob.el (test-ob/where-is-src-block-result): Update
test.

Reported-by: stardiviner <numbchild@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2020-05/msg00198.html>
2020-05-13 15:35:56 +02:00
Nicolas Goaziou e68ae40bdb babel: Remove unneeded declare function 2020-04-28 09:51:20 +02:00
Mattias Engdegård 989a51105c Backport commit d5a7df8c0 from Emacs
* lisp/ob-core.el (org-babel-remove-temporary-directory): Use
directory-files-no-dot-files-regexp.

Use directory-files-no-dot-files-regexp wherever possible
d5a7df8c02f04102d50a5cd2290262f59f2b1415
Mattias Engdegård
Thu Apr 16 12:14:38 2020 +0200
2020-04-20 00:42:44 -04:00
Kyle Meyer b359de549e Merge branch 'maint' 2020-04-20 00:42:38 -04:00
Mattias Engdegård bf99b6dc11 Backport commit 4acdd7fe5 from Emacs
* lisp/ob-core.el (org-babel-remove-temporary-directory):
Use (rx (or (not ".") "...")), translated into "[^.]\\|\\.\\.\\.", to
match anything but "." and "..".

Fix edge case errors in filename-matching regexps
4acdd7fe58ae9f94102afeca67b0383141d597da
Mattias Engdegård
Tue Apr 14 12:25:16 2020 +0200

Note(km): Replaced bare "." with (any ".") for Emacs < 27
compatibility.  4acdd7fe5 was on the emacs-27 branch, but a commit on
their master (d5a7df8c0) will supersede this.
2020-04-20 00:41:39 -04:00
Kyle Meyer 9e385d1bab Merge branch 'maint' 2020-04-09 22:29:48 -04:00
Kyle Meyer 6f1b837492 Silence byte-compiler
These both show up when compiling files separately (e.g., 'make
single').

ob-core already assumes ob-tangle is loaded based on declared
functions, presumably because ob.el is given responsibility for
collectively loading these pieces.  org.el loads org-attach within the
body of a function before calling org-attach-dir.
2020-04-09 22:27:06 -04:00
Nicolas Goaziou 06fe9d6b05 ob: Improve handling of :wrap header
* lisp/ob-core.el (org-babel-insert-result): Improve handling of :wrap
header.
* testing/lisp/test-ob.el (test-ob/inline-src_blk-wrap): New test.
(test-ob/preserve-comma-escape): Add test.
2020-04-07 01:42:35 +02:00
Nicolas Goaziou 0a7e382c27 Merge branch 'maint' 2020-04-07 01:22:18 +02:00
Nicolas Goaziou e3373f4beb ob-core: Properly replace results in special blocks
* lisp/ob-core.el (org-babel-result-end): Handle results in special
blocks.
* testing/lisp/test-ob.el (test-ob/replace-special-block-result): New
test.
2020-04-07 01:21:33 +02:00
Mattias Engdegård b78583a1c1 Backport commit 770f76f05 from Emacs
Make regexps smaller and faster by removing terms that are superfluous
by virtue of standing next to another term that matches more.  See
https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00949.html
for details.

* lisp/ob-core.el (org-babel-remove-result):
* lisp/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org-capture.el (org-capture-set-target-location):
* lisp/org-compat.el (org-maybe-keyword-time-regexp):
* lisp/org-table.el (org-table-expand-lhs-ranges):
Remove subsumed repetitions.

Remove subsumed repetitions in regexps
770f76f050376bbd77a3cc8cf44db57cf855a27c
Mattias Engdegård
Thu Feb 20 16:05:18 2020 +0100
2020-03-15 22:51:31 -04:00
Nicolas Goaziou e18415d02c ob: Fix case when replacing Noweb reference
* lisp/ob-core.el (org-babel-expand-noweb-references): Use FIXEDCASE.
* testing/lisp/test-ob.el (test-ob/noweb-expansion): Add test.

Reported-by: Sebastian Miele <sebastian.miele@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2020-03/msg00070.html>
2020-03-09 23:10:04 +01:00