* ob-shell.el (org-babel-sh-evaluate): Add condition for async within
session. Allow :async header argument to be either t or blank.
* test-ob-shell.el:
(test-ob-shell/session-async-valid-header-arg-values): Check that
:async header works for both t and blank values.
(test-ob-shell/session-async-inserts-uuid-before-results-are-returned):
Check that UUID is used as placeholder until results return.
(test-ob-shell/session-async-evaluation): Check that asynchronously
evaluated results are eventually placed in the buffer.
Link: https://list.orgmode.org/186283d230a.129f5feb61660123.3289004102603503414@excalamus.com/
* lisp/org-element.el (org-element-headline-parser): Allow empty title
with tags. Do not consider space after COMMENT to be a part of title.
*
testing/lisp/test-org-element.el (test-org-element/headline-todo-keyword):
Add tests.
Reported-by: Leo Butler <Leo.Butler@umanitoba.ca>
Link: https://orgmode.org/list/87zg8t4zgo.fsf@localhost
* lisp/org-element.el (org-element-headline-parser): Allow end of line
instead of space after todo keyword.
*
testing/lisp/test-org-element.el (test-org-element/headline-todo-keyword):
Add new test.
* lisp/org-clock.el (org-clock-get-clock-string): End the mode line
element in a space, instead of beginning with space, to make it play
well with other mode line strings, which typically end a space. For
reference, see the mode line string of the Display Time mode.
* lisp/org-element.el (org-element-set-contents): Do alter anonymous
elements (el1 el2 ...). Such elements are used, for example, when
parsing keyword values during export, like :title.
* testing/lisp/test-org-element.el (test-org-element/set-contents):
Add test.
The patch fixed bug during export when exporting a subtree with
option stat:nil. The :title during subtree export is taken from the
heading title and parsed. However, the parsed value is stored outside
the parse tree, in :title property of the INFO channel. The parsed
value does get filtered through `org-export--prune-tree', but before
this commit, `org-element-set-contents' did not actually alter the
out-of-AST-tree parent lists of elements.
Reported-by: Leo Butler <Leo.Butler@umanitoba.ca>
Link: https://orgmode.org/list/87mt4w8epo.fsf@t14.reltub.ca
* lisp/ob-table.el (org-sbe): Allow quoting string values of variables
with "$". Update the docstring.
* testing/lisp/test-ob-table.el (test-ob-table/sbe): Add test. Do not
use `org-test-at-id' in favor of more illustrative
`org-test-with-temp-text'. The latter does not force users to search
the ID in reference Org file.
* testing/examples/babel.org (calling code blocks from inside table):
Remove unused example.
Reported-by: 赵一宇 <zhyznd@163.com>
Link: https://orgmode.org/list/40651be0.3e3b.1867971e644.Coremail.zhyznd@163.com
* lisp/org.el (org-metaup):
(org-metadown): When active region contains headings, move the
containing subtrees according to the selection. Do not deactive
region.
* testing/lisp/test-org.el (test-org/move-subtree): Add test.
* etc/ORG-NEWS (~org-metaup~ and ~org-metadown~ now act on headings in
region): Announce the new features.
* lisp/org-element.el: Query cache variables from the base buffer.
They are only kept up-to-date there.
* testing/lisp/test-org.el (test-org/map-entries): Add test.
Reported-by: Hanno Perrey <hanno@hoowl.se>
Link: https://orgmode.org/list/87pmau4fi3.fsf@hoowl.se
* lisp/org-element.el (org-element-cache-map): Never map over element
starting before the point manually moved (or set via
`org-element-cache-map-continue-from') by FUNC.
* testing/lisp/test-org.el (test-org/map-entries): Add tests.
Reported-by: Matthieu Caneill <matt@brokenwa.re>
Link: https://orgmode.org/list/Y9MKUzWWbErLFhmq@brokenwa.re
* testing/lisp/test-ob-octave.el (ob-octave/graphics-file):
(ob-octave/graphics-file-session): Do not assert that octave must not
emit warnings. Just test the file created by side effect.
We currently have no reliable way to disambiguate warnings from
non-zero exit code when using `org-babel-eval'. Warnings are ok, as
long as they do not result in the file not being created in the test.
Link: https://orgmode.org/list/87mt6m5n6u.fsf@localhost
* testing/lisp/test-ob-shell.el (test-ob-shell/remote-with-stdin-or-cmdline):
Work around non-local exit when running tests on Emacs 26. Do no call
`kill-matching-buffers' unless Emacs in newer.
* lisp/org-capture.el (org-capture-finalize): Do not save the newly
created file buffer when the capture is aborted and org-capture is not
asked to save upon capture.
* testing/lisp/test-org-capture.el (test-org-capture/abort): Add test.
* org-datetree.el (org-datetree--find-create): Add optional argument
MATCH-TITLE that controls whether to match REGEX-TEMPLATE against
heading title inside complex heading or to match REGEX-TEMPLATE
against the whole heading line.
* org-datetree.el (org-datetree--find-create-group,
org-datetree-find-iso-week-create): Allow finding a datetree with TODO
state, priority, tags, statistics cookies, or COMMENT keyword.
* testing/lisp/test-org-datetree.el
(test-org-datetree/find-date-create,
test-org-datetree/find-iso-week-create): Add tests for a datetree with
tags, TODO or priority keywords.
* etc/ORG-NEWS (Datetree structure headlines can now be complex):
Document the change.
* doc/org-manual.org: Update datetree definition.
* lisp/org.el (org-paste-subtree): Remove the whole line when level
indicator is provided. Improve check for level indicator.
* testing/lisp/test-org.el (test-org/paste-subtree): Add test.
Reported-by: Philipp Kiefer <phil.kiefer@gmail.com>
Link: https://orgmode.org/list/a2cc49d3-7f65-5f6a-8f05-21e5056335b3@gmail.com
* lisp/org-refile.el (org-refile): Use dedicated marker (move after
insertion) to store position of the heading being refiled. Otherwise,
if refiled heading is inserted at the same point, `save-excursion'
would restore point before the inserted heading instead of keeping it
at the original heading.
* testing/lisp/test-org.el (test-org/refile): At test.
Reported-by: /u/madclassix
* lisp/org-element.el (org-element-fixed-width-interpreter): Interpret
fixed-width element with :value "" as ":\n", not as empty string.
* testing/lisp/test-org-element.el (test-org-element/fixed-width-interpreter):
Fixed the test.
The previous test, albeit intentionally asserting "" result, breaks
reversibility of parse-interpret sequence.
* testing/lisp/test-ob-shell.el:
- Give instructions on how to run tests
- Require `org-test' explicitly
- Group tests into sections
- Insert `page-delimiter's between sections
* testing/examples/ob-shell-test.org: Delete file
File was used by test-ob-shell.el to test ob-shell.el. Tests have
been updated to use temporary buffers, rendering ob-shell-test.org
unnecessary.
* testing/lisp/test-ob-shell.el:
(ob-shell/generic-uses-no-arrays): Rename test from
`ob-shell/generic-uses-no-arrays' to
`test-ob-shell/generic-uses-no-arrays'.
(ob-shell/generic-uses-no-arrays): Move comments from
testing/examples/ob-shell-test.org to docstring.
(ob-shell/generic-uses-no-arrays): Remove dependency on
testing/examples/ob-shell-test.org.
(ob-shell/bash-uses-arrays): Rename `ob-shell/bash-uses-arrays' to
`test-ob-shell/bash-uses-arrays'.
(ob-shell/bash-uses-arrays): Move comments from
testing/examples/ob-shell-test.org to docstring.
(ob-shell/bash-uses-arrays): Remove dependency on
testing/examples/ob-shell-test.org.
(ob-shell/simple-list): Change test name from `ob-shell/simple-list'
to `test-ob-shell/simple-list'.
(ob-shell/remote-with-stdin-or-cmdline): Change test name from
`ob-shell/remote-with-stdin-or-cmdline' to
`test-ob-shell/remote-with-stdin-or-cmdline'.
(ob-shell/remote-with-stdin-or-cmdline): On pass, kill buffer created
by test.
(ob-shell/results-table): Rename `ob-shell/results-table' to
`test-ob-shell/results-table'.
(ob-shell/results-list): Rename `ob-shell/results-list' to
`test-ob-shell/results-list'.
(ob-shell/standard-output-after-success): Rename
`ob-shell/standard-output-after-success' to
`test-ob-shell/standard-output-after-success'.
(ob-shell/standard-output-after-failure): Rename
`ob-shell/standard-output-after-failure' to
`test-ob-shell/standard-output-after-failure'.
(ob-shell/standard-output-after-failure): On pass, kill buffer created
during test.
(ob-shell/error-output-after-success): Rename
`ob-shell/error-output-after-success' to
`test-ob-shell/error-output-after-success'.
(ob-shell/error-output-after-success): On pass, kill buffer created by
test.
(ob-shell/error-output-after-failure): Rename
`ob-shell/error-output-after-failure' to
`test-ob-shell/error-output-after-failure'.
(ob-shell/error-output-after-failure): On pass, kill buffer created by
test.
(ob-shell/error-output-after-failure-multiple): Rename
`ob-shell/error-output-after-failure-multiple' to
`test-ob-shell/error-output-after-failure-multiple'.
(ob-shell/error-output-after-failure-multiple): On pass, kill buffer
created by test.
(ob-shell/exit-code): Rename `ob-shell/exit-code' to
`test-ob-shell/exit-code'.
(ob-shell/exit-code): On pass, kill buffer created by test.
(ob-shell/exit-code-multiple): Rename `ob-shell/exit-code-multiple' to
`test-ob-shell/exit-code-multiple'.
(ob-shell/exit-code-multiple): On pass, kill buffer created by test.
* testing/lisp/test-ob-shell.el (ob-shell/bash-uses-assoc-arrays):
Split test cases into separate tests,
`test-ob-shell/bash-uses-assoc-arrays' and
`test-ob-shell/bash-uses-assoc-arrays-with-lists'. Rename prefix from
"ob-shell" to "test-ob-shell".
(ob-shell/bash-uses-assoc-arrays): Move comments from
testing/examples/ob-shell-test.org to docstrings.
(ob-shell/bash-uses-assoc-arrays): Remove dependency on
testing/examples/ob-shell-test.org.
* test-ob-shell.el (ob-shell/generic-uses-no-assoc-arrays): Split test
based on simple versus complex mapping cases,
`test-ob-shell/generic-uses-no-assoc-arrays-simple-map' and
`test-ob-shell/generic-uses-no-assoc-arrays-3-columns'. Rename prefix
from "ob-shell" to "test-ob-shell".
(ob-shell/generic-uses-no-assoc-arrays): Move
headlines and commentary from `testing/examples/ob-shell-test.org' to
docstring.
(ob-shell/generic-uses-no-assoc-arrays): Remove dependency on
testing/examples/ob-shell-test.org.
* testing/lisp/test-ob-shell.el (ob-shell/session): Split
`ob-shell/session' into
`test-ob-shell/session-single-return-returns-string' and
`test-ob-shell/session-multiple-returns-returns-list'.
(ob-shell/session): Rename comint from to test name. On
pass, kill process and remove process buffer.
* testing/lisp/test-ob-shell.el
(test-ob-shell/dont-error-on-empty-results): Explicitly test handling
of empty results.
(test-ob-shell/dont-error-on-babel-error): Explicitly test handling of
Babel errors. On pass, remove buffers created during test.
Original test conflated empty results (a valid Babel return) and Babel
errors.
* testing/lisp/test-ob-octave.el (ob-octave/graphics-file):
(ob-octave/graphics-file-session):
(ob-octave/graphics-file-space): Wrap GET-BUFFER in BUFFER-LIVE-P.
This ensures that a killed buffer does not cause an incorrect failure
of a test.
Link: https://orgmode.org/list/87bknh5nva.fsf@localhost
Most copyright years were updated with the port of Emacs's cae528457
in e0815d754. Update the remaining copyright years for files that
have Free Software Foundation as the copyright holder but aren't
included in the Emacs repo.
* testing/lisp/test-ob-octave.el (ob-octave/graphics-file):
(ob-octave/graphics-file-session):
(ob-octave/graphics-file-space): Do not check the created image file
size. This tests causes race condition between the test and Octave
writing image to disk. Also, the correctness of image file is nothing
of Org's business as long as ob-ocatave's Elisp implementation is
concerned.
* testing/lisp/test-ob-shell.el:
- Give instructions on how to run tests
- Require `org-test' explicitly
- Group tests into sections
- Insert `page-delimiter's between sections
* testing/examples/ob-shell-test.org: Delete file
File was used by test-ob-shell.el to test ob-shell.el. Tests have
been updated to use temporary buffers, rendering ob-shell-test.org
unnecessary.
* testing/lisp/test-ob-shell.el:
(ob-shell/generic-uses-no-arrays): Rename test from
`ob-shell/generic-uses-no-arrays' to
`test-ob-shell/generic-uses-no-arrays'.
(ob-shell/generic-uses-no-arrays): Move comments from
testing/examples/ob-shell-test.org to docstring.
(ob-shell/generic-uses-no-arrays): Remove dependency on
testing/examples/ob-shell-test.org.
(ob-shell/bash-uses-arrays): Rename `ob-shell/bash-uses-arrays' to
`test-ob-shell/bash-uses-arrays'.
(ob-shell/bash-uses-arrays): Move comments from
testing/examples/ob-shell-test.org to docstring.
(ob-shell/bash-uses-arrays): Remove dependency on
testing/examples/ob-shell-test.org.
(ob-shell/simple-list): Change test name from `ob-shell/simple-list'
to `test-ob-shell/simple-list'.
(ob-shell/remote-with-stdin-or-cmdline): Change test name from
`ob-shell/remote-with-stdin-or-cmdline' to
`test-ob-shell/remote-with-stdin-or-cmdline'.
(ob-shell/remote-with-stdin-or-cmdline): On pass, kill buffer created
by test.
(ob-shell/results-table): Rename `ob-shell/results-table' to
`test-ob-shell/results-table'.
(ob-shell/results-list): Rename `ob-shell/results-list' to
`test-ob-shell/results-list'.
(ob-shell/standard-output-after-success): Rename
`ob-shell/standard-output-after-success' to
`test-ob-shell/standard-output-after-success'.
(ob-shell/standard-output-after-failure): Rename
`ob-shell/standard-output-after-failure' to
`test-ob-shell/standard-output-after-failure'.
(ob-shell/standard-output-after-failure): On pass, kill buffer created
during test.
(ob-shell/error-output-after-success): Rename
`ob-shell/error-output-after-success' to
`test-ob-shell/error-output-after-success'.
(ob-shell/error-output-after-success): On pass, kill buffer created by
test.
(ob-shell/error-output-after-failure): Rename
`ob-shell/error-output-after-failure' to
`test-ob-shell/error-output-after-failure'.
(ob-shell/error-output-after-failure): On pass, kill buffer created by
test.
(ob-shell/error-output-after-failure-multiple): Rename
`ob-shell/error-output-after-failure-multiple' to
`test-ob-shell/error-output-after-failure-multiple'.
(ob-shell/error-output-after-failure-multiple): On pass, kill buffer
created by test.
(ob-shell/exit-code): Rename `ob-shell/exit-code' to
`test-ob-shell/exit-code'.
(ob-shell/exit-code): On pass, kill buffer created by test.
(ob-shell/exit-code-multiple): Rename `ob-shell/exit-code-multiple' to
`test-ob-shell/exit-code-multiple'.
(ob-shell/exit-code-multiple): On pass, kill buffer created by test.
* testing/lisp/test-ob-shell.el (ob-shell/bash-uses-assoc-arrays):
Split test cases into separate tests,
`test-ob-shell/bash-uses-assoc-arrays' and
`test-ob-shell/bash-uses-assoc-arrays-with-lists'. Rename prefix from
"ob-shell" to "test-ob-shell".
(ob-shell/bash-uses-assoc-arrays): Move comments from
testing/examples/ob-shell-test.org to docstrings.
(ob-shell/bash-uses-assoc-arrays): Remove dependency on
testing/examples/ob-shell-test.org.
* test-ob-shell.el (ob-shell/generic-uses-no-assoc-arrays): Split test
based on simple versus complex mapping cases,
`test-ob-shell/generic-uses-no-assoc-arrays-simple-map' and
`test-ob-shell/generic-uses-no-assoc-arrays-3-columns'. Rename prefix
from "ob-shell" to "test-ob-shell".
(ob-shell/generic-uses-no-assoc-arrays): Move
headlines and commentary from `testing/examples/ob-shell-test.org' to
docstring.
(ob-shell/generic-uses-no-assoc-arrays): Remove dependency on
testing/examples/ob-shell-test.org.
* testing/lisp/test-ob-shell.el (ob-shell/session): Split
`ob-shell/session' into
`test-ob-shell/session-single-return-returns-string' and
`test-ob-shell/session-multiple-returns-returns-list'.
(ob-shell/session): Rename comint from to test name. On
pass, kill process and remove process buffer.
* testing/lisp/test-ob-shell.el
(test-ob-shell/dont-error-on-empty-results): Explicitly test handling
of empty results.
(test-ob-shell/dont-error-on-babel-error): Explicitly test handling of
Babel errors. On pass, remove buffers created during test.
Original test conflated empty results (a valid Babel return) and Babel
errors.
* testing/lisp/test-ob-octave.el (ob-octave/graphics-file):
(ob-octave/graphics-file-session):
(ob-octave/graphics-file-space): Delay `should' condition waiting for
file contents to be written by octave. This may be necessary when
octave has not yet written the file contents (on slow machines).
Re-enable tests.
Link: https://orgmode.org/list/87r0wk29dz.fsf@localhost
* lisp/org-element.el (org-element-inlinetask-parser): Parse
inlinetasks closer to headings. In particular, recognize COMMENT
keyword and ARCHIVE tag in inlinetasks on parser level.
* testing/lisp/test-org.el (test-org/comment-dwim): Add tests for
inlinetasks and for uncommenting headings.
Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25508.20192.899342.932809@gargle.gargle.HOWL
(ob-octave/graphics-file):
(ob-octave/graphics-file-session):
(ob-octave/graphics-file-space): Disable tests until we figure the
origin of CI failures. The tests are passing locally.
Link: https://orgmode.org/list/87cz8ifioa.fsf@localhost
* lisp/ob-core.el (org-babel-insert-result): Do not treat table lines
in RESULT verbatim.
* testing/lisp/test-ob-shell.el (ob-shell/results-list): Add new test.
Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/m2tu1v8gj8.fsf@me.com
* lisp/ob-core.el (org-babel-insert-result): Do not treat table lines
in RESULT verbatim.
* testing/lisp/test-ob-shell.el (ob-shell/results-list): Add new test.
Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/m2tu1v8gj8.fsf@me.com
* lisp/ob-octave.el (org-babel-execute:octave):
-Ensure that the special Octave variable `ans' is bound when
GFX-FILE is non-nil. The glue code in
ORG-BABEL-OCTAVE-WRAPPER-METHOD causes Octave to exit with a
non-zero exit code when `ans' is not bound.
-Change format control string to %S from %s. Ensure the graphics
filename is quoted. If it is not, Octave may create a mis-named
file or fail entirely.
* testing/examples/ob-octave-test.org:
Update the Graphical tests section:
-put in the correct headers;
-add a remark about where to find each test.
* testing/lisp/test-ob-octave.el:
Add the three tests ob-octave/graphics-file,
ob-octave/graphics-file-session and ob-octave/graphics-file-space.
-ob-octave/graphics-file: The first test verifies that the first bug
identified above is fixed; it also verifies that graphics file
creation works correctly for scripting.
-ob-octave/graphics-file-session: The second test verifies graphics
file creation works correctly for sessions. The Octave command
`crash_dumps_octave_core(0)' is included to prevent the creation of
a core file (`octave-workspace').
-ob-octave/graphics-file-space: The third test verifies that a
graphics filename with a space in it is created correctly.
Thanks to Ihor Radchenko for helpful feedback.
Ref: https://list.orgmode.org/8735asbtfe.fsf@localhost/T/#u
* lisp/ob-octave.el (org-babel-execute:octave):
-Ensure that the special Octave variable `ans' is bound when
GFX-FILE is non-nil. The glue code in
ORG-BABEL-OCTAVE-WRAPPER-METHOD causes Octave to exit with a
non-zero exit code when `ans' is not bound.
-Change format control string to %S from %s. Ensure the graphics
filename is quoted. If it is not, Octave may create a mis-named
file or fail entirely.
* testing/examples/ob-octave-test.org:
Update the Graphical tests section:
-put in the correct headers;
-add a remark about where to find each test.
* testing/lisp/test-ob-octave.el:
Add the three tests ob-octave/graphics-file,
ob-octave/graphics-file-session and ob-octave/graphics-file-space.
-ob-octave/graphics-file: The first test verifies that the first bug
identified above is fixed; it also verifies that graphics file
creation works correctly for scripting.
-ob-octave/graphics-file-session: The second test verifies graphics
file creation works correctly for sessions. The Octave command
`crash_dumps_octave_core(0)' is included to prevent the creation of
a core file (`octave-workspace').
-ob-octave/graphics-file-space: The third test verifies that a
graphics filename with a space in it is created correctly.
Thanks to Ihor Radchenko for helpful feedback.
Ref: https://list.orgmode.org/8735asbtfe.fsf@localhost/T/#u
* ob-R.el (org-babel-R-assign-elisp): Use the patch from
ccberry@health.ucsd.edu, to print org-list as a one column table as it
was the case in release_9.5. The break in R is due commit b4e437f96 *
ob-core: Resolve named list references to simple lists.
* test-ob-R.el (ob-R-nested-list): New function to test that org list
with multiple level are handled as expected in R.
see https://list.orgmode.org/87bkofh0ir.fsf@localhost/ for context.
* test-ob-R.el (ob-session-R-result-output): This test will check if
output is printed to buffer in a session with :results output. This
test is to prevent the bug mentioned in https://list.orgmode.org/877czca7oj.fsf@u-bordeaux.fr/
does not happen again.
* lisp/org-fold-core.el (org-fold-core-save-visibility): Calculate
folds on runtime, not during macro expansion.
* testing/lisp/test-org.el (test-org/org-ctrl-c-ctrl-c): Add test
ensuring that outline visibility is preserved upon refreshing Org
setup.
Reported-by: Matt Lundin <mdl@imapmail.org>
Link: https://orgmode.org/list/87wn70tlcn.fsf@fastmail.fm
* ob-R.el (org-babel-R-assign-elisp): Use the patch from
ccberry@health.ucsd.edu, to print org-list as a one column table as it
was the case in release_9.5. The break in R is due commit b4e437f96 *
ob-core: Resolve named list references to simple lists.
* test-ob-R.el (ob-R-nested-list): New function to test that org list
with multiple level are handled as expected in R.
see https://list.orgmode.org/87bkofh0ir.fsf@localhost/ for context.
* test-ob-R.el (ob-session-R-result-output): This test will check if
output is printed to buffer in a session with :results output. This
test is to prevent the bug mentioned in https://list.orgmode.org/877czca7oj.fsf@u-bordeaux.fr/
does not happen again.
* lisp/ob-core.el (org-babel-result-to-file): When file path in the
result contains attachment dir, reduce the path to relative file name
when generating attachment: link.
* testing/lisp/test-ob.el (test-ob-core/dir-attach): Add test.
Reported-by: Johan Tolö <johan@toloe.se>
Link: https://orgmode.org/list/875yesnia6.fsf@toloe.se
* testing/lisp/test-org-element.el (test-org-element/class):
Uncomment. Whatever caused the failure in the past is not longer the
problem. Tests are passing.
* lisp/ob-core.el (org-babel-read-list): Return a simple list instead
of list of lists. Document this in the docstring.
* testing/lisp/test-ob-java.el (ob-java/read-return-list):
(ob-java/read-list-return-array):
(ob-java/read-return-list-with-package): Fix tests assuming previous
behavior.
* testing/lisp/test-ob.el (test-ob/simple-variable-resolution): Add
new tests.
* etc/ORG-NEWS (List references in source block variable assignments
are now proper lists): Document the change.
This commit fixes the broken promise in the manual section 16.4
Environment of a Code Block where the named references to lists should
be converted to simple lists consisting of the top-level items.
The inconsistency existed for a while and possibly lurked into some
third-party packages. So, announcement in NEWS is required.
Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/87pmdqfao4.fsf@localhost
* lisp/ob-table.el (org-sbe): Do not try to execute code block during
macro expansion.
* testing/lisp/test-ob-table.el (test-ob-table/sbe): Uncomment the
test. Update the expected return value.
* lisp/ox-html.el (
org-html-mathjax-options,
org-html-mathjax-template,
org-html--build-mathjax-config
): Update from MathJax 2 to 3 while maintaining compatibility. All
legacy options should continue to work, except for the 'path' option
which must now point to MathJax 3 or later.
* testing/lisp/test-ox-html.el (
ox-html/mathjax-path-none,
ox-html/mathjax-path-default,
ox-html/mathjax-path-custom,
ox-html/mathjax-path-in-buffer,
ox-html/mathjax-options-default,
ox-html/mathjax-options-custom,
ox-html/mathjax-options-in-buffer,
ox-html/mathjax-legacy-scale-default,
ox-html/mathjax-legacy-scale-custom,
ox-html/mathjax-legacy-scale-in-buffer,
ox-html/mathjax-legacy-scale-message,
ox-html/mathjax-legacy-scale-message-in-buffer,
ox-html/mathjax-legacy-scale-ignore,
ox-html/mathjax-legacy-autonumber-ams,
ox-html/mathjax-legacy-autonumber-ams-in-buffer,
ox-html/mathjax-legacy-autonumber-none,
ox-html/mathjax-legacy-autonumber-none-in-buffer,
ox-html/mathjax-legacy-autonumber-all,
ox-html/mathjax-legacy-autonumber-all-in-buffer,
ox-html/mathjax-legacy-autonumber-message,
ox-html/mathjax-legacy-autonumber-message-in-buffer,
ox-html/mathjax-legacy-font-tex,
ox-html/mathjax-legacy-font-tex-in-buffer,
ox-html/mathjax-legacy-font-stix-web,
ox-html/mathjax-legacy-font-stix-web-in-buffer,
ox-html/mathjax-legacy-font-asana-math,
ox-html/mathjax-legacy-font-asana-math-in-buffer,
ox-html/mathjax-legacy-font-neo-euler,
ox-html/mathjax-legacy-font-neo-euler-in-buffer,
ox-html/mathjax-legacy-font-gyre-pagella,
ox-html/mathjax-legacy-font-gyre-pagella-in-buffer,
ox-html/mathjax-legacy-font-gyre-termes,
ox-html/mathjax-legacy-font-gyre-termes-in-buffer,
ox-html/mathjax-legacy-font-latin-modern,
ox-html/mathjax-legacy-font-latin-modern-in-buffer,
ox-html/mathjax-legacy-line-breaks-true,
ox-html/mathjax-legacy-line-breaks-true-in-buffer,
ox-html/mathjax-legacy-line-breaks-false,
ox-html/mathjax-legacy-line-breaks-false-in-buffer,
ox-html/mathjax-legacy-line-breaks-message,
ox-html/mathjax-legacy-line-breaks-message-in-buffer): Test MathJax in
general and also the conversion of legacy options from MathJax 2 to 3.
* testing/org-test.el (org-test-capture-messages): Add a new macro
useful for testing the messages put in the echo area.
* etc/ORG-NEWS: Document MathJax 2 to 3 upgrade, highlighting the
benefits of the new version but also mentioning the fact that the user
may need to update the `path' option in `org-html-mathjax-options'.
* doc/org-manual.org (Math formatting in HTML export): Update the link
to the MathJax CDN and the example of how to use `+HTML_MATHJAX' with
MathJax 3. Also, remove the note on MathJax extensions, as they did
not work (and do not work) as documented.
Link: https://list.orgmode.org/orgmode/m2a667n4ax.fsf@me.com/
* lisp/org.el (org-set-regexps-and-options): Allow spaces when
defining link abbreviations via #+LINK keyword.
* testing/lisp/test-org-element.el (test-org-element/link-parser): Add
a new test.
* doc/org-manual.org (Link Abbreviations): Add example demonstrating
link abbreviation with spaces.
Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/87zgf7zujc.fsf@localhost
* lisp/ox.el (org-export--parse-option-keyword): Allow `read'ing the
option value as far as needed. Do not restrict the value to the first
whitespace only. This way, one can use Elisp strings with all the
escaping options as values.
* testing/lisp/test-ox.el (test-org-export/parse-option-keyword): Add
test for option value with a space inside.
Reported-by: Pierre Balayé <pierrebalaye@gmail.com>
Link: https://list.orgmode.org/orgmode/CANpQAF-n+4xhNvL8aaP8j2gJ70vbu80wmh9a4Oj0BxNHA5-yDA@mail.gmail.com/
* testing/org-test.el (org-test-load): Skip test files that throw
'missing-test-dependency. Skipped tests are explicitly listed in test
summary and thus more visible. This also distinguishes such tests
from known bugs.
* testing/lisp/test-ob-python.el (test-ob-python/assign-underscore):
Do not wrap code into `should' form as much as possible to avoid
truncated backtrace.
* lisp/org-list.el (org-toggle-item): When headings contain
footnote-definitions, move them out of the list. Footnote-definitions
must not be indented and hence cannot belong to the list. Ensure that
definitions do not slurp the following element after the list.
Consider when the list created by `org-toggle-item' is continued by an
existing list.
* testing/lisp/test-org-list.el (test-org-list/toggle-item): Add
tests.
Reported-by: Ypo <ypuntot@gmail.com>
Link: https://orgmode.org/list/877d3k70lu.fsf@localhost
* testing/lisp/test-org-num.el (test-org-num/max-level):
(test-org-num/skip-numbering):
(test-org-num/update):
* testing/lisp/test-org-table.el (test-org-table/toggle-column-width):
Do not expect specific overlay order in the return value of
`overlays-in'. The order is not guaranteed by the docstring and has
been changed in Emacs 29.
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59067
* lisp/org.el (org-time-stamp-formats):
* lisp/org.el (org-time-stamp-custom-formats): Change the default
values stripping leading "<" and trailing ">". Update the docstring
explaining the format and that leading and trailing brackets are now
ignored. Update the :type specification to more precise.
(org-time-stamp-format): Update the argument list and docstring
allowing to use the function more flexibly to find the time stamp
format for both `org-time-stamp-formats' and
`org-time-stamp-custom-formats'. Rename `long' argument to more
accurate `with-time'. Ignore brackets in the `org-time-stamp-formats'
and `org-time-stamp-custom-formats'. Allow `inactive' argument to be
`no-brackets'
(org-format-timestamp):
(org-read-date-display):
(org-insert-time-stamp):
(org-display-custom-time):
(org-timestamp-translate):
* lisp/org-compat.el (org-timestamp-format): Rename
`org-timestamp-format' to `org-format-timestamp'. The old variant is
too similar with other `org-time-stamp-format' function. Also, use
`org-time-stamp-format' to determine the timestamp format instead of
using `org-time-stamp-formats' directly.
* lisp/ol.el (org-store-link):
* lisp/org-agenda.el (org-agenda-get-timestamps):
(org-agenda-get-progress):
* lisp/org-archive.el (org-archive-subtree):
(org-archive-to-archive-sibling):
* lisp/org-clock.el (org-clock-special-range):
* lisp/org-colview.el (org-colview-construct-allowed-dates):
* lisp/org-element.el (org-element-timestamp-interpreter):
* lisp/org-macro.el (org-macro--find-date):
* lisp/org-pcomplete.el (pcomplete/org-mode/file-option/date):
* lisp/ox-odt.el (org-odt--format-timestamp):
(org-odt-template):
* lisp/ox.el (org-export-get-date):
* testing/lisp/test-org.el (test-org/timestamp-format): Use
`org-time-stamp-format' instead of directly examining
`org-time-stamp-custom-formats' and `org-time-stamp-formats'. Use the
new function name `org-format-timestamp'.
* etc/ORG-NEWS (Default values and interpretations of ~org-time-stamp-formats~ and ~org-time-stamp-custom-formats~ are changed):
(~org-timestamp-format~ is renamed to ~org-format-timestamp~):
(Updated argument list in ~org-time-stamp-format~): Document the
user-facing changes.
This commit documents and unifies previously undocumented assumptions
about the values of `org-time-stamp-formats' and
`org-time-stamp-custom-formats'. Instead of fiddling with
leading/trailing brackets in the values, expedite the time format
calculation to `org-time-stamp-format'. The undocumented assumption
about brackets in user option `org-time-stamp-custom-formats' is not
relaxed making the docstring correct.
Reported-by: Uwe Brauer <oub@mat.ucm.es>
Link: https://orgmode.org/list/87k04ppp1t.fsf@localhost
* lisp/ob-tangle.el (org-babel-tangle-single-block): Strip noweb tags
from block if :noweb has been set to "strip-tangle".
* lisp/ob-core.el (org-babel-common-header-args-w-values): Add
"strip-tangle" as new allowed value.
* lisp/ob-core.el (org-babel-noweb-p): Add "strip-tangle" at the
appropriate positions.
* testing/lisp/test-ob-tangle.el (ob-tangle/strip-tangle): Add new test
case for "strip-tangle".
* doc/org-manual.org (Noweb Reference Syntax): Adjust documentation for
the noweb header argument.
* etc/ORG-NEWS: Add entry for new header argument value.
This patch adds the "strip-tangle" option for the :noweb header
argument. This strips the noweb tags before tangling the block. This can
be useful for e.g. testing purposes where one wants to use a block as
test case that can be both run inline as well as tangled into a file for
automated testing.
TINYCHANGE
* testing/listp/test-org-clock (test-org-clock/clock-drawer-dwim): Add
new test for DWIM updates of days for clocks in logbook drawers.
Reported-by: Bruce E. Robertson <brucer42@gmail.com>
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=53393
* lisp/ob-eval.el (org-babel-eval-error-notify): Do not insert
superfluous whitespace.
* lisp/ob-eval.el (org-babel-eval): Show standard error even if the
command exits with a zero code.
* testing/lisp/test-ob-shell.el(
ob-shell/standard-output-after-success,
ob-shell/standard-output-after-failure,
ob-shell/error-output-after-success,
ob-shell/error-output-after-failure,
ob-shell/error-output-after-failure-multiple,
ob-shell/exit-code,
ob-shell/exit-code-multiple
): Add tests to avoid regressions.
* lisp/ox-latex.el (org-latex-line-break-safe):
(org-latex-table-row):
Change \empty ending to explicit optional argument. \empty still has
undesired side effects in some cases.
* testing/lisp/test-org-table.el (test-org-table/to-latex):
* testing/lisp/test-ox-latex.el (test-ox-latex/verse): Update tests.
Reported-by: Juan Manuel Macías <maciaschain@posteo.net>
Link: https://orgmode.org/list/87o7u9rz1a.fsf@posteo.net
* lisp/org-datetree.el (org-datetree-insert-line): Use
`org--blank-before-heading-p' check.
* testing/lisp/test-org-datetree.el (test-org-datetree/find-date-create):
(test-org-datetree/find-month-create):
(test-org-datetree/find-iso-week-create): Explicitly set
`org-blank-before-new-entry' assumed throughout the tests.
Note that the `auto' behavior in `org-blank-before-new-entry' is
somewhat arbitrary. It currently prefers no blank lines by
default (when no other headings are present in the buffer). I went
with fixing the tests rather than changing
`org--blank-before-heading-p' to prefer inserting blank lines. This
should make lesser impact on the end users.
Reported-by: Richard Walker <walkerrichardj@gmail.com>
Link: https://list.orgmode.org/orgmode/CAFyNgSE4mAt+b0Ks8L9bg2LbHcXnayOh+bYyONTQ4jN+zx3C1w@mail.gmail.com/
* lisp/org-refile.el (org-refile-get-targets): Use a document
title (#+TITLE) instead of file or buffer name in outline path, if a
corresponding customisation option is set to 'title. Fallback to a
filename if there is no title in the document.
* lisp/org-refile.el (org-refile-use-outline-path): Add a new option
'title, see above.
* lisp/ob-core.el (org-babel-string-read): Only considered \" at the
string boundaries, not inside.
* testing/lisp/test-ob-shell.el (ob-shell/results-table): Add a test.
* testing/lisp/test-ob.el (test-ob/org-babel-results-indented-list):
Add a regression test for the recent change to ob-core list formatting
in e700578799.
* lisp/ob-comint.el (org-babel-comint-with-output): Clean up empty
output. Such output is emitted unnecessarily for multi-line scripts.
* lisp/ob-shell.el (org-babel-shell-set-prompt-commands): Disable
PS2 and equivalent prompts. Make sure that PROMPT_COMMAND does not
interfere with PS1 setting in POSIX shells.
(org-babel-sh-evaluate): Do not send input line-by-line. Instead, let
`org-babel-coming-with-output' handle waiting for the output as well
as recording it. Update to the new `org-babel-coming-with-output'
behavior of cleaning empty outputs.
* testing/lisp/test-ob-shell.el (test-ob-shell/session): Add a test.
Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://list.orgmode.org/orgmode/m2r0zboix1.fsf@me.com/
* testing/lisp/test-ob-java.el (ob-java/lint-header-arguments):
Rename to ob-java/lint-header-args-block.
* testing/lisp/test-ob-java.el (ob-java/lint-header-args-heading):
Test source block header arguments at the heading level.
* testing/lisp/test-ob-java.el (ob-java/lint-header-args-buffer):
Test source block header arguments at the buffer level.
Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/m2y1ta9rqe.fsf@me.com
* lisp/ob-java.el (org-babel-header-args:java): Complete the list of
header arguments supported for Java source blocks.
* testing/lisp/test-ob-java.el (ob-java/lint-header-arguments): Test
that the linter approves of all the supported arguments.
Add a property `:parameters' to special blocks, to store the
PARAMETERS as a string.
* lisp/org-element.el (org-element-special-block-parser): Parse
PARAMETERS and set the property `:parameters'.
(org-element-special-block-interpreter): Interpret the property
`:parameters'.
*
testing/lisp/test-org-element.el (test-org-element/special-block-parser):
Add a new test for PARAMETERS.
(test-org-element/special-block-interpreter): Add new tests for PARAMETERS.
* lisp/org-element.el (org-element-special-block-interpreter): Use
empty string when content is nil.
*
testing/lisp/test-org-element.el (test-org-element/special-block-interpreter):
Test the case with no content.
* lisp/ox-latex.el (org-latex-verse-block): Fix logic replacing sole
paragraph breaks according to the new template.
* testing/lisp/test-ox-latex.el: New test file.
(org-test-with-exported-text): New macro for testing export.
(test-ox-latex/verse): New test.
* mk/default.mk (BTEST_RE): Select the new test by default.
Reported-by: Juan Manuel Macías <maciaschain@posteo.net>
Link: https://orgmode.org/list/875ygk6a8z.fsf@posteo.net
* lisp/ox-latex.el (org-latex-line-break-safe, org-latex-table-row):
* testing/lisp/test-org-table.el (test-org-table/to-latex): Use \empty
instead of \relax to prevent interpreting following "*" and "[" as
optional parts of \\*[LENGTH] command.
Fix regression introduced by 3f60acff77. \\\relax\hline caused
misaligned \noalign error. Org markup:
| a |
|---|
\hline is allowed only immediately after \cr while \relax has some side
effects. Hope, \empty just expands to nothing.
Those who used \\ optional argument to adjust amount of space between
lines may add the following tricks:
First,\\
@@latex:{\vskip1em}@@second.
| First |
| @@latex:\noalign{\vskip1em}@@second |
Reported in
gerard.vermeulen, Wed, 12 Oct 2022 03:15:49 +0000.
https://list.orgmode.org/784cf8be450b7d676ddd60214cc847db@posteo.net
* testing/lisp/test-ob-sql.el (test-ob-sql):
* testing/lisp/test-ob-sqlite.el (test-ob-sqlite): Add missing provide
and use the correct file name in the comments.
* testing/lisp/test-ob-eshell.el (ob-eshell/execute):
(ob-eshell/variables-assignment): Do not expect
`org-babel-execute-src-block' to return the actual inserted src block
string.
* lisp/org-cycle.el (org-cycle-set-visibility-according-to-property):
Do not unconditionally run `org-fold-reveal' for headlines with
"VISIBILITY" property. `org-fold-reveal' can break the global
visibility and ancestor headline visibility settings.
*
testing/lisp/test-org-fold.el (test-org-fold/set-visibility-according-to-property):
Add test.
Reported-by: Eduardo Suarez <esuarez@itccanarias.org>
Link: https://orgmode.org/list/20220409202736.GA28127@itccanarias.org
* lisp/ox-latex.el (org-latex-linebreak-safe): New constant holding
safe version of LaTeX line break.
(org-latex-table-matrix-macros):
(org-latex-clock):
(org-latex-line-break):
(org-latex-plain-text):
(org-latex-planning):
(org-latex--org-table):
(org-latex--math-table):
(org-latex-table-row):
(org-latex-verse-block): Use the new constant.
* testing/lisp/test-org-table.el (test-org-table/to-latex): Update
tests.
Reported-by: Stewart Thomas <sjt015@bucknell.edu>
Link: https://orgmode.org/list/ce760fc3-5aae-144d-2d02-7dea215f73fc@gmail.com
* testing/lisp/test-ox.el (test-org-export/org-export-copy-buffer):
Make sure that `org-export-with-buffer-copy' does not show up when
Emacs is searching for buffers associated with file.
* testing/lisp/test-ob-java.el (ob-java/simple-dir):
(ob-java/simple-dir-with-package): Prefer `temporary-file-directory'
over `org-babel-temporary-directory'. The latter is nil in
noninteractive Emacs during tests.
Reported-by: Christian Köstlin <christian.koestlin@gmail.com>
* lisp/ob-ref.el (org-babel-ref-resolve): When the result an empty
list, then treat it as a list, not as the symbol nil.
* testing/lisp/test-ob.el (test-ob/post-header-arguments): Add new
test.
* etc/ORG-NEWS (Post-processing code blocks can return an empty list):
Document change in behavior.
* lisp/org-agenda.el (org-agenda-local-vars):
(org-agenda-filters-preset): Add a new variable
`org-agenda-filters-preset' for storing per-buffer filter presets.
(org-agenda):
(org-agenda-filter-any):
(org-agenda-prepare):
(org-agenda-finalize):
(org-agenda-redo):
(org-agenda-filter-by-tag):
(org-agenda-filter-make-matcher):
(org-agenda-set-mode-name):
(org-agenda-reapply-filters): Use `org-agenda-filters-preset' for
getting and setting per-buffer filter presets, rather than modifying
the global symbol property. Change `org-lprops' from symbol property
to per-buffer text property. Delete unused `last-args' symbol
property.
* testing/lisp/test-org-agenda.el (test-org-agenda/sticky-agenda-filter-preset):
(test-org-agenda/redo-setting): Add tests.
* lisp/org.el (org--at-headline-data-p): New function used to check if
element at point belongs to headline data.
(org--get-expected-indentation):
(org-indent-line): Use `org--at-headline-data-p' instead of
explicit (and inaccurate) condition.
* testing/lisp/test-org.el (test-org/indent-region): Add tests.
Fixes incorrect LOGBOOK drawer indentation when
`org-adapt-indentation' is set to 'headline-data.
* lisp/ob-core.el (org-babel-expand-noweb-references): Do not rely on
reference cache being populated as a condition that all the references
in buffer have been processed. Set this information explicitly.
* testing/lisp/test-ob.el (test-ob/noweb-expansion): Add new test.
* testing/org-batch-test-init.el (lambda): Remove the code that has
never been working. One could still rewrite the code using
`autoloadp', but it would break things terribly and should not be
needed as autoload does not need to be updated after changing the
`load-path'. See
https://orgmode.org/list/jwvedwczhbv.fsf-monnier+emacs@gnu.org
Mainly, add the corresponding cookie, but also add various `require`s
so that the compiler knows which vars should be trated as dynbound.
This does not fix all the warnings, but does try to eliminate
all those about "unused" variables. For the variables truly unused,
the patch usually adds an underscore to their name to silence the warning.
Some of the fixes affect files which already used `lexical-binding`.
Not sure why the test worked before: maybe because the tests were run
without compiling them first (which could cause some of the
missing `require`d packages to be autoloaded before we got to the
problematic code, thus hiding the problem)?
I found some suspicious code, for which I added FIXMEs.
There are also a few changes to the main files.
* lisp/org-protocol.el (org-protocol-check-filename-for-protocol):
Don't call `server-edit` if it's not yet defined. [ Needed to get
the tests to pass. ]
* lisp/ob-core.el (org-babel-temporary-directory)
(org-babel-temporary-stable-directory): Always define (and use nil
if we don't want to create a directory for it). Simplify the code based
on the fact that (defvar V E) only evaluates E if V is not yet `boundp`.
(org-babel-temp-file, org-babel-temp-stable-file)
(org-babel-remove-temporary-directory)
(org-babel-remove-temporary-stable-directory): Adjust accordingly.
* lisp/org.el (org-log-beginning): Add FIXME.
* testing/org-test.el: Require `org` and `org-id`.
(org-id-locations-file): Don't `defconst` it.
(org-test-at-id, org-test-in-example-file, org-test-at-marker)
(org-test-with-temp-text, org-test-with-temp-text-in-file): Move edebug
specs into `declare` (and simplify them).
(org-test-with-tramp-remote-dir--worker): Declare dynbound tramp vars.
(org--compile-when): Fix quoting of `exp`.
(org-test-load): Tweak regexps.
* testing/org-batch-test-init.el: Tweak regexp, remove dead code and
add a FIXME about it.
* testing/lisp/test-ox.el: Require `ox` instead of
erroring out if it's not already loaded. Also require `org-inlinetask`.
(org-test-with-parsed-data): Silence warnings when `info` is not used.
(test-org-export/bind-keyword): Add FIXME.
* testing/lisp/test-ox-publish.el: Require `org-test` and `ox-publish`.
(test-org-publish/resolve-external-link): Expose lambdas to
the compiler. Remove unused var `ids`.
(test-org-publish/get-project-from-filename): Remove unused var `file`.
* testing/lisp/test-org.el: Require `org-macs`, `org`,
`org-inlinetask`, `org-refile`, and `org-agenda`.
(test-org/org-read-date): Declare `org-time-was-given` as dynbound.
(test-org/set-regexps-and-options): Add FIXME.
* testing/lisp/test-org-timer.el: Require `org-timer`.
* testing/lisp/test-org-table.el: Require `ox`.
* testing/lisp/test-org-protocol.el: Require `org-protocol` instead of
erroring out if it's not already loaded. Also require `capture`, and
add missing `provide` statement.
* testing/lisp/test-org-pcomplete.el: Require `org`.
* testing/lisp/test-org-list.el: Require `org-list` and `org`.
* testing/lisp/test-org-lint.el: Require `org-footnote` and `org-lint`.
* testing/lisp/test-org-footnote.el: Require `org-footnote`.
* testing/lisp/test-org-element.el: Require `org-element` instead of
erroring out if it's not already loaded. Also require `org` and
`org-inlinetask`.
* testing/lisp/test-org-duration.el: Require `org-duration`.
* testing/lisp/test-org-datetree.el: Require `org-datetree`.
* testing/lisp/test-org-colview.el: Require `org-colview`,
`org-duration`, and `org-inlinetask`.
* testing/lisp/test-org-clock.el: Require `org-duration` and `org-clock`.
* testing/lisp/test-org-archive.el: Require `org-archive`.
* testing/lisp/test-org-agenda.el
(test-org-agenda/bulk-custom-arg-func): Add FIXME.
* testing/lisp/test-ol.el: Require `ol` and `org-id`.
(test-org-link/store-link): Declare `org-store-link-props` and add FIXME.
* testing/lisp/test-oc.el (test-org-cite/export-capability): Add FIXME.
* testing/lisp/test-ob.el: Require `ob-core`, `org-src`, `ob-ref`,
and `org-table`.
(test-ob/eval-header-argument): Rename `foo` to `test-ob--foo` and
declare it as dynbound.
(test-ob/blocks-with-spaces, test-ob/specific-colnames): Add FIXME.
(test-ob/noweb-expansions-in-cache):
Declare `noweb-expansions-in-cache-var` as dynbound.
* testing/lisp/test-ob-tangle.el: Require `org` and `ob-tangle`.
* testing/lisp/test-ob-shell.el:
* testing/lisp/test-ob-python.el: Require `ob-core`.
* testing/lisp/test-ob-lob.el: Require `ob-lob`.
(temporary-value-for-test): Declare as dynbound.
* testing/lisp/test-ob-plantuml.el: Require `ob-plantuml` instead of
erroring out if it's not already loaded.
* testing/lisp/test-ob-lilypond.el: Require `ob-lilypond` instead of
erroring out if it's not already loaded. Use `with-current-buffer`.
* testing/lisp/test-ob-julia.el: Require `ob-core`.
* testing/lisp/test-ob-java.el (org-babel-temporary-directory):
Remove dead code now that `org-babel-temporary-directory` is always bound.
* testing/lisp/test-ob-exp.el: Require `ob-exp`, `org-src`, and `org-test`.
(ob-exp/evaluate-all-executables-in-order):
Declare `*evaluation-collector*` as dynbound.
* testing/lisp/test-ob-emacs-lisp.el (ob-emacs-lisp/dynamic-lexical-edit)
(ob-emacs-lisp/dynamic-lexical-execute):
Rename dynbound var to `ob-emacs--x` and declare it as such.
* testing/lisp/test-ob-R.el: Require `ob-core`.
(ess-ask-for-ess-directory, ess-history-file): Declare vars.
lisp/ob-shell.el (org-babel-sh-evaluate): Use `process-file' (instead
of `call-process-shell-command') so that `org-babel-sh-evaluate' will
invoke file name handlers based on `default-directory', if needed,
like when using a remote directory.
lisp/org-compat.el (with-connection-local-variables): New
compatibility macro.
testing/lisp/test-ob-shell.el (ob-shell/remote-with-stdin-or-cmdline):
New test.
testing/org-test.el (org-test-with-tramp-remote-dir): New macro.
Fixes https://list.orgmode.org/CKMOBWBK709F.1RUN69SRWB64U@laptop/.
* lisp/org.el (org--open-file-format-command): New function with better
coverage of mailcap RFC 1524 syntax. Do not replace percent character
in file name or link component, fix substitution of multiple regular
expression groups matched in the link target.
(org-open-file): Use `org--open-file-format-command' instead of inline
code.
* testing/lisp/test-org.el (org-test/org--open-file-format-command):
Tests for `org--open-file-format-command'.
The primary goal of moving code outside of `org-open-file' function is to
make it testable.
It should fix the following issues:
- Maxim Nikulin. greedy substitution in org-open-file.
Wed, 20 Jan 2021 23:08:35 +0700.
https://list.orgmode.org/ru9ki4$t5e$1@ciao.gmane.io
- Rodrigo Morales. Org mode links: Open a PDF file at a given page
and highlight a given string. Tue, 02 Mar 2021 15:07:32 -0500.
https://list.orgmode.org/87lfb5pbej.fsf@gmail.com
* lisp/ob-ref.el (org-babel-ref-resolve): Add support for
`named-block[]' syntax, resolving to the contents of a named-block.
* lisp/ob-core.el (org-babel-read-element): Read a code block into its
contents, like other blocks.
* testing/listp/test-ob.el (test-ob/block-content-resolution): Test
block content resolution.
* doc/org-manual.org: Document syntax.
* etc/ORG-NEWS: Document syntax.
* lisp/ol-info.el (org-info--link-file-node): New helper to parse info
link info file (manual) name and node.
(org-info-follow-link, org-info-export): Use `org-info--link-file-node'.
(org-info-description-as-command): New function to create description
for info links that may executed to view the manual.
(org-link-parameters): Specify `org-info-description-as-command' as
`:insert-description' for info links.
(org-info-other-documents): Add URL of directory index.
* testing/lisp/test-org-info.el (test-org-info/export): Add cases for
texinfo export with link description.
(test-org-info/link-file-node, test-org-info/description-as-command):
New tests for new functions `org-info--link-file-node' and
`org-info-description-as-command'.
Use recently added :insert-description feature of `org-link'.
Alternative separators between file name and node ":", "::", "#:"
are preserved. Added interpretation of empty path or omitted
file name as info dir index.
* lisp/ob-tangle.el: Refactor the double implementation to a single
helper function. This avoids the double link wrapping.
* testing/lisp/test-ob-tangle.el: Add unit tests.
Babel tangle allows inserting comments at the tangled site which link
back to the source in the org file. This linking was implemented
twice, to handle separate cases, but when using ‘:comments noweb’ it
ended up going through both codepaths. This resulted in doubly
wrapped links.
By refactoring all link generation into a single function, this double
wrapping is avoided.
Example file, /tmp/test.org:
* Inner
#+name: inner
#+begin_src emacs-lisp
2
#+end_src
* Main
#+header: :tangle test.el :comments noweb :noweb yes
#+begin_src emacs-lisp
1
<<inner>>
#+end_src
Before:
;; [[file:test.org::*Main][Main:1]]
1
;; [[[[file:/tmp/test.org::inner][inner]]][inner]]
2
;; inner ends here
;; Main:1 ends here
After:
;; [[file:test.org::*Main][Main:1]]
1
;; [[file:test.org::inner][inner]]
2
;; inner ends here
;; Main:1 ends here
* test-ol (test-ol-with-link-parameters-as): Convenience macro for
testing.
(test-ol-insert-link-get-desc): Convenience macro for testing.
(test-ol/return-foobar): Convenience function for testing.
(test-ol/insert-link-insert-description): Test for various values of
`:insert-description' in `org-link-parameters' (including
`test-ol/return-foobar').
This reverts commit e22b4eb7aa.
See
https://list.orgmode.org/87r11wkmew.fsf@ucl.ac.uk/T/#mab6359ed2107d5515c6bb6b266551f0c5049ceca
The problem with the commit is that correctly loading local variables
early requires re-implementing all the built-in tricks done by Emacs,
like not enabling local variables in temp buffers or non-file buffers.
In addition, even if we call `hack-local-variables' manually, Emacs
will repeat the normal call later, possibly asking for non-safe
variables twice.
In conclusion, the whole idea of manual triggering local variables is
fragile and should better be handled by Emacs itself via stable API.
testing/.dir-locals.el is kept.
* lisp/org.el (org-mode): Call `hack-local-variables' early during Org
mode startup. This way, Org startup options will regard local
variable settings.
* testing/.dir-locals.el: Create a stub dir-locals file to prevent
tests from being affected by directory-local settings of the root Org
repo folder.
Fixes
https://list.orgmode.org/587be554-906c-5370-2cf2-f08b14fa58ff@gmail.com/T/#u
* testing/lisp/test-ol.el (test-ol/encode): Rename to
`test-org-link/encode'.
(test-ol/decode): Rename to `test-org-link/decode'.
(test-ol/encode-url-with-escaped-char): Rename to
`test-org-link/encode-url-with-escaped-char'.
(test-ol/org-toggle-link-display): Rename to
`test-org-link/toggle-link-display'.
(test-ol/escape): Rename to `test-org-link/escape'.
(test-ol/unescape): Rename to `test-org-link/unescape'.
(test-ol/make-string): Rename to `test-org-link/make-string'.
(test-ol/store-link): Rename to `test-org-link/store-link'.
(test-ol/update-radio-target-regexp): Rename to
`test-org-link/update-radio-target-regexp'.
(test-ol/next-link): Rename to `test-org-link/next-link'.
(test-ol/previous-link): Rename to `test-org-link/previous-link'.
(test-ol/plain-link-re): Rename to `test-org-link/plain-link-re'.
Only `test-ol/org-toggle-link-display' was executed during
"make test" since it is the only name matched by the "org|ob" default
selector. Reported in: Ihor Radchenko to emacs-orgmode.
Re [PATCH v7] ol.el: add description format parameter
to org-link-parameters. Sun, 24 Jul 2022 21:15:31 +0800.
https://list.orgmode.org/87v8rmd53g.fsf@localhost/
* lisp/org-plot.el (org-plot/gnuplot): Do not use `if-let'.
* lisp/ox-ascii.el (org-ascii--describe-links):
* lisp/ox-md.el (org-md--headline-referred-p): Do not use
`ignore-error'.
* testing/org-test.el (org-test-at-time): Fallback to older definition
of `decode-time' when it cannot accept 3 arguments.
* testing/lisp/test-ox.el: Bind `org-resource-download-policy' to t when
testing downloading.
* testing/lisp/test-org.el: Bind `org-resource-download-policy' to t
when testing downloading.
* testing/lisp/test-org.el (test-org/org-time-string-to-time):
Check that no daylight saving time value is forced for
`org-parse-time-string' and `org-encode-time' calls.
* lisp/ol.el (org-store-link):
* lisp/org-agenda.el (org-agenda-get-timestamps)
(org-agenda-get-progress, agenda-bulk-action):
* lisp/org-capture.el (org-capture-fill-template):
* lisp/org-clock.el (org-clock-get-sum-start)
(org-clock-special-range, org-clocktable-shift)
(org-clocktable-steps):
* lisp/org-colview.el (org-colview-construct-allowed-dates):
* lisp/org-datetree.el (org-datetree-find-iso-week-create)
(org-datetree-insert-line):
* lisp/org-element.el (org-element-timestamp-interpreter):
* lisp/org-macro.el (org-macro--vc-modified-time):
* lisp/org-macs.el (org-matcher-time):
* lisp/org.el (org-current-time, org-current-effective-time)
(org-add-planning-info, org-read-date, org-read-date-display)
(org-read-date-analyze, org-eval-in-calendar)
(org-calendar-select, org-display-custom-time)
(org-calendar-select-mouse, org-time-string-to-time)
(org-time-from-absolute, org-at-clock-log-p)
(org-date-from-calendar, org-get-cursor-date)
(org-timestamp-to-time):
* testing/lisp/test-org-clock.el (org-test-clock-create-timestamp):
* lisp/ox-icalendar.el (org-icalendar-convert-timestamp):
Avoid direct calls of `encode-time', use `org-encode-time' instead.
Org supports Emacs-26, but the recommended way to call `encode-time'
changed in Emacs-27. In Emacs-29 DST and TZ elements of the single list
arguments became optional. In Org it is still convenient to call the
function with separate arguments without explicit DST and TZ arguments.
The `org-encode-time' should mitigate attempts to modernize Org code
directly in the Emacs repository.
* lisp/org-macs.el (org-encode-time): New compatibility and convenience
helper macro to allow a list for time components or separate arguments
independently of Emacs version.
* testing/lisp/test-org.el (org-test-with-timezone): New macro to ensure
that some code is executed with certain TZ environment value and thus
particular daylight saving time or other time shift rules are active.
* testing/lisp/test-org.el (test-org/org-encode-time): Tests for various
ways to call `org-encode-time'.
Ensure recommended way to call `encode-time' for Emacs-27 and newer with
hope to avoid bugs due to attempts to modernize the code similar to
bug#54731. 6-elements list may be allowed as `encode-time' argument
since Emacs-29, see bug#54764.
* testing/lisp/test-org.el (test-org/org-read-date, test-org/deadline)
(test-org/schedule, test-org/time-stamp, test-org/timestamp-from-time):
* testing/org-test.el (org-test-at-time): Use `org-time-string-to-time'
instead of composition of `org-parse-time-string' and `encode-time'.
The actual goal is to prepare to replace `encode-time' by
`org-encode-time' compatibility and convenience macro.
* testing/lisp/test-org.el (ert-deftest test-org/org-parse-time-string):
Update test expectations to use DST of -1 (guess) after fix of
`org-parse-time-string'.
* testing/lisp/test-org-clock.el (org-test-clock-create-timestamp):
Do not change timezone from nil to 0. Prevent test failures in zones
other than UTC.
*
testing/lisp/test-org-fold.el (test-org-fold/org-fold-reveal-broken-structure):
Test `org-delete-char' instead of `delete-char'. The former is the
function used interactively.
* lisp/org.el (org-setup-filling): Set fill-forward-paragraph-function.
(org--single-lines-list-is-paragraph): New internal variable. Whether
a list with single lines items should be considered a single
paragraph.
(org--paragraph-at-point): use org--single-lines-list-is-paragraph.
(org-fill-paragraph): When an active region contains a list ensure
every item get filled.
* testing/lisp/test-org.el (test-org/fill-paragraph):
(test-org/fill-region): Test behaviour of fill-paragraph and
fill-region with an active region containing a list.
When filling paragraphs in a region, do not treat a list with single
lines items as a single paragraph.
* lisp/org-list.el (org-cycle-list-bullet): Keep point position
relative to bullet beginning/end when changing the list bullet.
* testing/lisp/test-org-list.el (test-org-list/cycle-bullet): Add
tests.
Fixes https://orgmode.org/list/m2wndjfi32.fsf@gmail.com
* lisp/ob-exp.el (org-babel-exp-src-block): New optional argument
providing ELEMENT at point.
(org-babel-exp-code-template): Use lower-case #+begin/#+end lines to
avoid triggering source code block changes when the blocks are
exported with :exports code and also contain lower-case
#+begin/#+end. We prefer lower-case default because other parts of
Org, like `org-insert-structure-template' default to lower-case as
well.
(org-babel-exp-process-buffer): Do no disable cache as changes are not
expected to be as frequent anymore. Pass pre-calculated element at
point to inner function calls to `org-in-commented-heading-p',
`org-in-archived-heading-p', `org-element-context', and
`org-babel-exp-src-block'. Do not force-replace source block contents
when no change is required.
* testing/lisp/test-ob-exp.el (ob-export/export-with-results-before-block):
(ob-export/body-with-coderef):
(ob-exp/src-block-with-affiliated-keyword): Update tests according to
the new `org-babel-exp-code-template'.
* ob-core.el (org-babel-merge-params): Specifying the symbol 'attach`
or string "'attach" as the value of the `:dir' header now functions as
":dir (org-attach-dir nil t) :mkdirp t".
(org-babel-result-to-file): Optional TYPE argument accepts symbol
'attachment to fixup up paths under `(org-attach-dir)' and use the
link type "attachment:" when that is detected.
(org-babel-insert-result): Pass symbol `attachment' as TYPE to
`org-babel-result-to-file'.
* org-attach.el (org-attach-dir): Added autoload header to simplify
dependencies necessary to support this feature (called in
`org-babel-merge-params').
* test-ob.el (test-ob-core/dir-attach): Added unit test for the new
attach feature.
* lisp/org-list.el (org-list-struct-apply-struct): Make sure the
origin marker is not moved to bol when promoting/demoting item in
special case:
- item
- <point> ::
Do not remove the trailing space after point as well.
(org-insert-item): Do not expect point to remain at bol after writing
list struct.
* testing/lisp/test-org-list.el (test-org-list/indent-item): Add tests.
Fixes https://orgmode.org/list/87o88hlkvv.fsf@gmail.com
* lisp/ol.el (org-update-radio-target-regexp): Sort radio targets
before building the regexp that matches them.
* testing/lisp/test-org.el: Test shadowed radio targets. The bug
occurs when two targets share the same prefix and when and the longer
target appears first.
* lisp/org.el (org-property-separators, org-property-get-separator):
Created.
(org-entry-get, org-entry-get-with-inheritance): Use new
`org-property-get-separator' function.
* testing/lisp/test-org.el (test-org/entry-get): Added tests for
combining properties with custom separators
`org-property-separators' is a customization option that allows for
properties to be combined using a separator other than the default (a
single space). It is an alist with the car of each element being a
list of property names or regular expression and the cdr being the
separator string, like '((("EXPORT_FILE_NAME") . "/")).
* lisp/org.el (org--deadline-or-schedule): Match warning period if
provided in TIME arg.
* testing/lisp/test-org.el (test-org/deadline): Add relevant tests.
Fixes https://orgmode.org/list/87o85bl582.fsf@localhost
* lisp/org-element.el (org-element--current-element): Use
`org-element-dynamic-block-open-re' to match blocks.
* testing/lisp/test-org-element.el (test-org-element/paragraph-parser):
Fix test relying on previous incorrect behaviour. Empty #+BEGIN:
should be parsed as a keyword.
Reported in https://list.orgmode.org/Ycay4s3iAdEGSwgt@tuxteam.de/T/#t
* lisp/ox-latex.el (org-latex-src-block, org-latex-keyword,
org-latex-inline-src-block, org-latex-template,
org-latex--caption/label-string, org-latex-engraved-preamble,
org-latex-listings): Replace `org-latex-listings' with
`org-latex-src-block-backend', which now can be set to listings/verbatim
and no longer advertises t/nil as valid values.
* lisp/ox-beamer.el (org-beamer-template): Update in the same manner as
`org-latex-template'.
* lisp/org-compat.el: Make `org-latex-listings' an obsolete alias for
`org-latex-src-block-backend'.
* testing/lisp/test-ox.el: Replace `org-latex-listings' reference with
`org-latex-src-block-backend'.
* doc/org-manual.org (Footnotes, LaTeX specific properties, Literal
Examples): Replace references to `org-latex-listings' with
`org-latex-src-block-backend'.
* etc/ORG-NEWS: Add a news entry noting this change.
The variable `org-latex-listings' originally indicated whether source
blocks should use the listings LaTeX package, or not. This usage has
evolved over the years, and now it sets one of four different
fontification backends. This renaming should make the variable name a
bit less misleading.
* lisp/org-fold-core.el (org-fold-core-folded-p): Allow list of fold
types to be passed as argument.
* lisp/org-fold.el (org-fold-check-before-invisible-edit--overlays):
(org-fold-check-before-invisible-edit--text-properties): Make
overlay/text-property behaviour consistent. Do not handle edits
inside folded links. Fix inconsistencies.
* testing/lisp/test-org-fold.el:
* testing/lisp/test-org.el: Move folding-related tests to new test
file.
* testing/lisp/test-org-fold.el:
(test-org-fold/org-catch-invisible-edits): New test.
See https://orgmode.org/list/m2o809q170.fsf@gmail.com
* testing/lisp/test-org-macs.el (ert-deftest test-org/fill-template):
There is a bug in `org-fill-template': it sorts and processes keys in
order of increasing length, so that "noweb" is seen before
"noweb-ref", and "tangle" before "tangle-mode". So in a template that
includes "%noweb-ref", it will substitute the value of "noweb".
This change includes a test for this bug.
TINYCHANGE
* lisp/org-clock.el (org-clock-in):
(org-clock-find-position):
(org-clock-out):
* lisp/org.el (org-add-planning-info):
(org-scan-tags):
(org-global-tags-completion-table):
(org-make-tags-matcher):
(org-tags-expand):
(org--property-local-values):
(org-read-date-analyze):
(org-revert-all-org-buffers):
(org-beginning-of-line): Make sure that we inherit invisible state
when inserting text.
(org-sort-entries): Preserve invisible state after replace-match.
(org-log-beginning): Do not try to move by visible lines.
* lisp/org-macs.el (org-preserve-local-variables): Do not try to
preserve overlays.
* lisp/ox.el (org-export--generate-copy-script): Preserve folding
properties in export buffer.
* testing/lisp/test-ob.el (test-ob/preserve-results-indentation): Fix
test failure.
* testing/lisp/test-org.el (test-org/meta-return):
(test-org/custom-properties): Use new folding.
* testing/lisp/test-org-agenda.el (test-org-agenda/property-timestamp):
Fix test that failed because of different behavior of agenda view
depending whether the view is called today (according to system date)
or not. Today's agenda (even called with custom date argument)
display the past scheduled items, while it is not the case for
non-today agendas.
* testing/lisp/test-org-agenda.el (test-org-agenda/one-line):
(test-org-agenda/scheduled-non-todo):
(test-org-agenda/non-scheduled-re-matces):
(test-org-agenda/property-timestamp):
(test-org-agenda/diary-inclusion):
(test-org-agenda/set-priority):
Add a note to warn future test developers about potential surprising
agenda behaviour.
* lisp/org-agenda.el (org-agenda-get-timestamps): Use
`org-at-timestamp-p' instead of org-element to check if at valid
timestamp. Agenda should consider timestamps inside node properties
even though they are not parsed by org-element.
* testing/lisp/test-org-agenda.el (test-org-agenda/property-timestamp):
Add new test checking active timestamp inside property drawer.
* testing/examples/agenda-file.org (test timestamp inside properties):
Add heading for `test-org-agenda/property-timestamp'.
Reported in https://list.orgmode.org/06d301d83d9e$f8b44340$ea1cc9c0$@tomdavey.com
* lisp/org.el (org-copy-visible): Decide whether text is invisible by
calling invisible-p rather than checking whether the invisible
property at point is non-nil.
Text may have a non-nil invisible property but _not_ be hidden from
the user (and thus should be copied by org-copy-visible). For
example, the link itself is shown when org-link-descriptive is nil,
but it still has an invisible property of `org-link'.
* lisp/org.el (org-copy-visible): Don't copy invisible text that
follows invisible text with a different property value.
If org-copy-visible sees that the left bound position has a non-nil
invisible property, it uses next-single-char-property-change to find
the new bound. However, next-single-char-property-change may just
find a bound that still has a _different_ non-nil invisible property.
Reported-by: "Максим Бабушкин" <maxbabushkin@gmail.com>
Link: https://debbugs.gnu.org/49967
* testing/lisp/test-org.el (test-org/copy-visible): Switch defun to
ert-deftest so that the test is actually executed, and resolve
failures in test.
Make two adjustments so that the now executed test passes:
- Correct the end value of the hidden part of the string for one
test case.
- Disable org-unfontify-region so that the invisible properties show
up in the temporary buffer.
I think org-unfontify-region should probably be changed to _not_
remove the invisible property, but it's a longstanding behavior.
Changing it would need more thought and isn't something that
should be done on the bugfix branch.
* lisp/org-list.el (org-list-send-item): Check if dest is a string
before matching it, to allow dest to be a buffer position.
* testing/lisp/test-org-list.el (test-org-list/send-item): Add tests.
* lisp/org-element.el (org-element-context): Use
`org-element-at-point', which makes use of cache.
* testing/lisp/test-org-element.el (test-org-element/lineage): Expect
full lineage up to org-data from `org-element-context'.
* testing/examples/agenda-file.org: Add test headings where SCHEDULED
line is not planning.
*
testing/lisp/test-org-agenda.el (test-org-agenda/non-scheduled-re-matces):
Make sure that SCHEDULED lines that do no belong to planning do not
trigger agenda matches.
See https://list.orgmode.org/20220101200103.GB29829@itccanarias.org/T/#t
* lisp/org-element.el (org-element--cache-for-removal): Consider
preceding keywords to be updated unconditionally.
(org-element-cache-map): Fix infinite loop revealed by the new test.
* testing/lisp/test-org-element.el (test-org-element/cache-affiliated):
New test.
* lisp/org-element.el (org-element-cache-map-continue-from): New
variable forcing `org-element-cache-map' to continue from a custom
point in buffer.
(org-element-cache-map): Add support for
`org-element-cache-map-continue-from'. Update docstring accordingly.
Also, make sure that mapping terminates correctly when FUNC deletes
all elements in buffer.
* testing/lisp/test-org.el (test-org/map-entries): Add test.
Fixes https://orgmode.org/list/CADywB5KOJ1p0NpvA=iX-ybHsO=huGA8qL3xMpUTETmS2qp7_ng@mail.gmail.com
* lisp/org-element.el (org-element--cache-after-change): Always extend
changed region to bol.
* testing/lisp/test-org-element.el (test-org-element/cache): Add test
checking the new fix. Amend some tests around making sure that cache
is active during testing.
* lisp/org-element.el (org-element--cache-after-change): Extend
changed region to bol when we are editing near beginning of an element
within or right after indentation. Such edits potentially change
:post-blank value of the previous element.
* testing/lisp/test-org-element.el (test-org-element/cache): Add test
checking one of such cases.
* testing/lisp/test-org-element.el (test-org-element/cache): Add new
tests checking against intersected elements and checking that Phase 2
removes obsolete elements.
* lisp/org-lint.el (org-lint-add-checker): New function.
(org-lint--generate-reports): Checker function now must be specified.
It is not deduced anymore from the name of the checker.
* testing/lisp/test-org-lint.el (test-org-lint/add-checker): New test.
* lisp/oc.el (org-cite-read-processor-declaration): New function.
(org-cite-store-export-processor): Use new function.
* testing/lisp/test-oc.el (test-org-cite/read-processor-declaration):
New test.
* testing/lisp/test-org-attach-git.el: Provide feature.
As of 9044b300e (org-test: Fix ERC errors using latest Emacs master,
2021-11-24), tests must provide a feature.
* testing/lisp/test-ob-C.el:
* testing/lisp/test-ob-awk.el:
* testing/lisp/test-ob-sed.el: Add missing provide.
* testing/lisp/test-property-inheritance.el: Fix incorrect feature
name.
* testing/org-test.el (org-test-load): Use `require' instead of
`load-file' to load tests. `load-file' can lead to duplicate test
definitions that now trigger ERC errors.
See https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-11/msg01968.html
* lisp/oc.el (org-cite-main-affixes): New function.
* lisp/oc-natbib.el (org-cite-natbib--build-optional-arguments): Use
new function.
* testing/lisp/test-oc.el (test-org-cite/main-affixes): New test.
* lisp/org-macro.el (org-macro--collect-macros): Multiple lines are
allowed for AUTHOR keyword (per `org-export-options-alist') so make
sure we collect all of them.
* testing/lisp/test-org-macro.el (test-org-macro/author): Add test.
Reported-by: Vinicius Vinicius <vinicius.vin@yandex.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-10/msg00727.html>
* lisp/org.el (org--collect-keywords-1): Use an accurate
function instead of an approximation. Accuracy trumps speed when parsing.
* testing/lisp/test-org.el (test-org/collect-keywords): New test.
* lisp/org-compat.el (org-file-name-concat): Do not use
`string-empty-p'.
(combine-change-calls): Create a stub when `combine-change-calls' were
not yet available.
(org-replace-buffer-contents): Add compatibility function for
`replace-buffer-contents'.
* lisp/org-element.el (org-element--current-element): Do not use
`if-let'.
* lisp/org-persist.el (org-persist-gc): Do not use `when-let'.
* lisp/org-plot.el (org-plot/gnuplot): Do not use `if-let'.
* lisp/org-src.el (org-edit-src-save, org-edit-src-exit): Use
`org-replace-buffer-contents'.
* lisp/org.el (org-narrow-to-subtree, org--property-local-values,
org-entry-get-with-inheritance, org-in-commented-heading-p,
org-up-heading-safe, org-goto-first-child): Do not use
`if-let'/`when-let'.
* testing/org-test.el (org-test-at-time): Fallback to old
`decode-time' specification in older Emacs.
* lisp/org-agenda.el (org-agenda-skip): Use
`org-in-archived-heading-p' and `org-in-commented-heading-p' in place
of text property cache.
(org-agenda-get-todos, org-agenda-get-timestamps,
org-agenda-get-sexps, org-agenda-get-progress,
org-agenda-get-deadlines, org-agenda-get-scheduled,
org-agenda-get-blocks): Do not use text property cache in favour of
Org API functions. The API functions use cache now.
* lisp/org-clock.el (org-element--cache-active-p): Declare function to
suppress compiler warning.
(org-clock-in): Do not use text property cache when element cache is
active.
* lisp/org-duration.el (org-duration-to-minutes): Do not change match
data. It is needed to not break agenda---agenda relies on match data
not being altered.
* lisp/org.el (org-run-like-in-org-mode): Use element cache.
(org-refresh-category-properties): Use element cache.
(org-make-tags-matcher, org-agenda-prepare-buffers): Do not rely on
text property cache.
* testing/lisp/test-org.el (test-org/refresh-category-properties): Do
not use text property cache.
* 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.
* lisp/oc.el (org-cite-process-citations): Add a space before citation
only if it is preceded by a quotation mark.
* testing/lisp/test-oc.el (test-org-cite/export-capability): Add
tests.
Reported-by: Denis Maier <denismaier@mailbox.org>
<http://lists.gnu.org/r/emacs-orgmode/2021-09/msg00085.html>